Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class SpawnItem : MonoBehaviour {
- public GameObject prefabToInstantiate;
- // Use this for initialization
- void Start () {
- StartCoroutine(SpawnAfterSeconds(1f));
- }
- IEnumerator SpawnAfterSeconds(float delay) {
- yield return new WaitForSeconds(delay);
- Vector3 randomSpawn = new Vector3(Random.Range(0, 5), Random.Range(0, 5), Random.Range(0, 5));
- Instantiate(prefabToInstantiate, randomSpawn, Quaternion.identity);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement