Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Spawner : MonoBehaviour
- {
- public float spawnRate = 0.5f;
- public float spawnCooldown = -1f;
- public GameObject enemyPrefab;
- void Update()
- {
- if (Time.time > spawnCooldown)
- {
- spawnCooldown = Time.time + spawnRate;
- Instantiate(enemyPrefab, transform.position, transform.rotation);
- }
- }
- }
Add Comment
Please, Sign In to add comment