using UnityEngine; using System.Collections; public class Randomized_Spawn_Tool : MonoBehaviour { [Header(">>>>>This script is designed as a quick tool for randomized loot spawning tool, it will spawn once a specifyed ammount of random objects once upon coming into existence.")] public int spawn_ammount = 1; public GameObject[] Random_Object_List; [Header("This controls the spread of the spawned gameobjects, the bigger the number, the further the objects are likely to appear from eachother")] public float SpawnPositionRandomizer = 1; void Awake(){ if(Random_Object_List!=null && Random_Object_List.Length>0){ int c = 0; do{ int randyVar = Random.Range(0,Random_Object_List.Length); Vector3 RandomizedPosition = new Vector3(transform.position.x+Random.Range(0,SpawnPositionRandomizer),transform.position.y+Random.Range(0,SpawnPositionRandomizer),transform.position.z+Random.Range(0,SpawnPositionRandomizer)); Instantiate(Random_Object_List[randyVar], RandomizedPosition, transform.rotation); c++;}while(c