|
i instantiated then made it a child so its position goes with the parent, but i wanted to destroy it when the parent and child collides with another object here is my script, var liquid : ParticleEmitter; var fluidflow : GameObject; var shaker : GameObject; function OnCollisionEnter(theCollision : Collision){ if(theCollision.gameObject.name == "Cube") { water = Instantiate(liquid, fluidflow.transform.position, transform.rotation); water.transform.parent = transform; } else if(theCollision.gameObject.name == "Cube3") { Destroy(); } }
(comments are locked)
|
|
You need to call Destroy( gameObject ), with gameObject as parameters. The seems ok.
(comments are locked)
|
