public void AddGameObject(ItemSector go, GameObject parent) { itemsToQueue.Enqueue(go); parentsToQueue.Enqueue(parent); //Debug.Log(string.Format("<color=green>Adding... </color> {0}", go.Id)); StartingCoroutine(); }
private void InstantiateObject(int items) { for (int n = 0; n < items; n++) { ItemSector item = itemsToQueue.Dequeue(); GameObject parent = parentsToQueue.Dequeue(); GameObject go = Instantiate(prefab.Find(i => i.name == item.idName)); go.transform.position = item.position; go.transform.rotation = item.rotation; go.transform.localScale = item.scale; go.transform.parent = parent.transform; parent.GetComponent <ItemsManager>().AddChildren(go); } }