Quantcast
Channel: Questions in topic: "clone"
Viewing all articles
Browse latest Browse all 508

How to stop instantiate spawn ?

$
0
0
Anybody know how can i stop cloning object when the game finish / times up ? I'am using InvokeRepeating to clone object, this is the script : using UnityEngine; using System.Collections; public class SpawnerScript : MonoBehaviour { public float spawnTime = 5f; public float spawnDelay = 3f; public GameObject[] myPrefab; void Start () { InvokeRepeating ("Spawn", spawnDelay, spawnTime); } void Spawn() { // Instantiate a random prefab int notPrefabIndex = Random.Range (0, myPrefab.Length); Instantiate (myPrefab [notPrefabIndex], transform.position, transform.rotation); } } Thanks before..

Viewing all articles
Browse latest Browse all 508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>