Hi,
I have this code and I want it when the object instantiate it will be destroyed after 1 second and so on with every object
Vector3 ufoSpeed;
public float Timer = .1f;
public Rigidbody ufo;
void Start()
{
ufoSpeed = (new Vector3(0, 0, Random.Range(-5, 5)));
}
void Update()
{
Timer -= Time.deltaTime;
if (Timer <= 0)
{
Rigidbody ufoClone;
ufoClone = Instantiate(ufo, new Vector3(0, 5, Random.Range(-5, 5)), transform.rotation) as Rigidbody;
ufoClone.AddForce(ufoSpeed);
Timer = 2;
}
}