Hey, I want to make a very simple enemy spawner, for a 2D game, but I’m new to Unity3D and I;m not sure how to go about doing it. I have 4 prefabs, named spawn1, spawn2, spawn3 and spawn4 - 2 of which are located on the left of the screen, 2 on the right. Here is the code on the prefab:
var enemySpeed: int;
function Update () {
amtToMove = enemySpeed * Time.deltaTime;
transform.Translate(Vector3.left * amtToMove);
//transform.Translate(Vector3.right * amtToMove); - for the prefabs on the left of the screen
}
I have a timer that counts down for 120 seconds, which uses the variables displayMinutes and displaySeconds. I want each of the prefabs to spawn a new enemy every 3 seconds. Is there a way I can do this?
Thanks in advance! ![]()
I'll test this later, thanks for the reply!
– CheenodashThis does work, but it spawns hundreds of the enemies instantly D:
– CheenodashIve edited the answer to include a possible fix??? Plz tell me if it works :)
– Benproductions1That works perfectly! Thank you very much!
– CheenodashIf my answer is correct please accept it as the answer :)
– Benproductions1