|
Lads, I'm trying to set up an OnCollision script so that falling chunks of debris will make a little puff of smoke particles and then be destroyed when touching the ground. I think the script looks pretty good, but I'm missing something. In actuality what is happening is that all debris objects simply disappear when I start the game. Any ideas?: function OnCollisionEnter(collision: Collision) { if (collision.gameObject.tag == "Terrain") Instantiate (explosionPrefab,transform.position,transform.rotation); Destroy (gameObject); } Thanks, Stef
(comments are locked)
|
|
At first I didn't see it, because your post was so badly formatted, but then I realised- You're missing brackets! This means that as soon as the object collides with anything, it immediately deletes itself, without even instantiating the explosion. Try this instead- Ah! I did not see that either. I blame the poor formatting ;)
Dec 03 '11 at 11:41 AM
OrangeLightning
(comments are locked)
|
