Here is the ‘player destroy’ script,
// Use this for initialization
void Start () {
}
void OnCollisionEnter2D(Collision2D coll) {
if(coll.gameObject.tag == "obstacle") {
Destroy(GameObject.Find("Player"), 1);
}
}
// Update is called once per frame
void Update () {
}
}
I am very new to unity, any help would be appreciated!
Yes you pry could. but be nice. dont destroy gameobjects when you dont have too.
read this:
unity garbage removal
simply move its coordinates offscreen, out of camera view, or transparent.
or if you feel really mean.
simply set the object or the objects script active to false. make sure the gameobject is in a variable to bring it back!
but if you still feel like you need to Destroy Something after my answer, i would recommend saving a prefab in the inspector to recreate from. if you want to go from scratch here is a link
adding components
this works to add scripts too.