- Home /
Question by
$$anonymous$$ · Jun 23, 2018 at 02:04 PM ·
destroydetectiondestroy object
Game object is destroyed
Hey! I have one object that goes down, but this object has a field where it should live and I want to do it when this object touches the edge of the field, the object will be destroyed, do you have any ideas?
Comment
Create a trigger collider or check the y position of your gameobject.
Answer by hectorux · Jun 25, 2018 at 04:55 AM
void OnCollisionEnter(Collision col){
if(col.name="EdgeName"){
Destroy(this);
}
}