teaching machines

Schedule something for future destruction in Unity

October 11, 2012 by . Filed under public, 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.