- Home /
Question by
Francissaccordi · Mar 24, 2014 at 07:12 AM ·
errorinstantiatespawndouble
Why my instantiate has error?
i want to make shooting game. and i make enemy is spawning once every 3 second. i use instantiate. but my enemy appear 1 clone in the first 3 second, and then 2 clone in second, and 3 clone in the third 3 second. so i have the things i want is only 1 enemy appear every 3 second. thankyou
void Update() jedaspawn += Time.deltaTime; if (jedaspawn > 3) { sekali = true; } if (sekali == true) { pesawatpink = (GameObject)GameObject.Instantiate(Resources.Load("Prefab/musuh")); pesawatpink.transform.position = posisi[acak]; jedaspawn = 0; sekali = false;
Comment
im sorry this is the script void Update() { jedaspawn += Time.deltaTime; if (jedaspawn > 3) { sekali = true;
}
if (sekali == true)
{
pesawatpink = (GameObject)GameObject.Instantiate(Resources.Load("Prefab/musuh"));
pesawatpink.transform.position = posisi[acak];
jedaspawn = 0;
sekali = false;
}
}