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);
}