- Home /
Question by
AtomicMarine · Jan 02, 2011 at 07:34 PM ·
iosdestroyprefabs
Destroying prefab clones after they have fired?
I have made a robot which shoots spheres.
I did this on the iphone and in the arena he is in the spheres just gather in the corners after i have shot them, how do i make them disappear after they have been shot?
Comment
Best Answer
Answer by schwertfisch · Jan 02, 2011 at 07:40 PM
You make a script and attach it to the prefab. You can call it "autoDestructor.js" or something. It will destroy your prefab after "lifespan" in seconds has passed.
JavaScript:
var lifespan : float;
function Awake() {
Destroy(gameObject, lifespan);
}