teaching machines

Schedule something for future destruction in Unity

Problem: I have a game object, a prefab probably, that I instantiate and velocify. It goes off screen. I want it gone then.

Solution: To expire a game object or component based merely on time, call Destroy(thingToDestroy, nSeconds). After nSeconds elapses, thingToDestroy will disappear.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *