- Home /
Question by
platium1337 · Aug 14, 2013 at 03:59 PM ·
bulletgun
bullets wont show up
I made a bullet thing that my gun shoots small cubes and it works normally but when i add my bullet script the cube comes and disappears instantly?
Here is the bullet script:
var maxDist : float = 1000000000;
var decalHitWall : GameObject;
var floatInFrontOfWall : float = 0.00001;
function Update ()
{
var hit : RaycastHit;
if (Physics.Raycast(transform.position, transform.forward, hit, maxDist))
{
if (decalHitWall && hit.transform.tag == "Level Parts")
Instantiate(decalHitWall, hit.point + (hit.normal * floatInFrontOfWall), Quaternion.LookRotation(hit.normal));
}
Destroy(gameObject);
}
Comment
Answer by roojerry · Aug 14, 2013 at 04:02 PM
You destroy the GameObject on the first frame of update. I assume you want the Destroy call within that if statement?
I watched a tutorial and the dude put it there and it worked for him just fine :( i removed it and now it works but the texture wont show up when i add it :( but thanks!
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Bullet Hole not inline with sight?(Center of Screen) 1 Answer
Error line 22! Help. i dont know why? 1 Answer
Problem doing a script. 2 Answers
bullet falls to ground 2 Answers