Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class SpawnScript : MonoBehaviour {
- public GameObject[] obj; // Here you insert spawning objects in game editor
- public float spawnMin = 0f; // Min seconds to spawn objects
- public float spawnMax = 0f; // Max seconds to spawn objects
- // Use this for initialization
- void Start () {
- Spawn (); // Calls spawn function
- }
- void Spawn()
- {
- Instantiate(obj[0], transform.position, Quaternion.identity); // This spawns objects
- Invoke ("Spawn", Random.Range (spawnMin, spawnMax)); // This repeats the process
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement