GigaOrts

Untitled

Jun 30th, 2025
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class ZombieSpawner : MonoBehaviour
  4. {
  5. public GameObject zombie;
  6. public Transform[] points;
  7. public float spawnRate = 1;
  8. private float timer = 0f;
  9.  
  10. void Update()
  11. {
  12. timer += Time.deltaTime;
  13. if (timer > spawnRate)
  14. {
  15. timer = 0f;
  16. Instantiate(zombie, points[Random.Range(0,points.Length)].position, Quaternion.identity);
  17. }
  18. }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment