usingUnityEngine;usingSystem.Collections;publicclassStone:MonoBehaviour{//Creamos una variable, para establecer cuando la piedra moriraprivateconstfloatyDie=-30f;// Use this for initializationvoidStart(){}// Update is called once per framevoidUpdate(){//Si la posicion y llega a ser menor que el valor donde debe morir, destruimosif(transform.position.y<yDie){//gameObject es el propio object asociado.Destroy(gameObject);}}}
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.