Friday, November 2, 2012

Unity prefab instance disappear itself after a while


Here is the code, enjoy


var lifeTime =1.0;

function Awake()
{
Destroy(gameObject, lifeTime);
}



1. Create a new javascript, paste in the code
2. attach this script to your game object prefab(example fireball)


No comments:

Post a Comment