Unity3D – Destroy if transform.position
Create a Cube and attach Cube.js:
#pragma strict function Updare(){ Destroy(); } function Destroy(){ // destroy this game object if y < 2 var posY : float = gameObject.transform.position.y; if (posY <= -2 ) { Destroy(gameObject); } } // END Destroy
Play and move the cube under 2 units in y