void Start() { count = 0; //getting dictionary from Inventory.cs applied on (Datahandler) dataHandler = GameObject.Find("DataHandler"); Inventory_Level_01 ino = dataHandler.GetComponent <Inventory_Level_01>(); dicForCompare = ino.dic; int pickedCount = dicForCompare.Count; //timeElapsed = Time.deltaTime; timeLeft = (float)timeFactor * (float)pickedCount; }
// Use this for initialization void Start() { //timePassed = Time.deltaTime; dataHandler = GameObject.Find("DataHandler"); Inventory_Level_01 ino = dataHandler.GetComponent <Inventory_Level_01>(); seq = ino.dic; n = seq.Count; // you can have 'n' children // Optional part can be removed after orignal logic foreach (var x in seq) { String s = x.Value.Name; print("x.Key==" + x.Key + " Name==" + x.Value.Name + " Value==" + x.Value.Random); GameObject item = NGUITools.AddChild(RootGrid, ItemPref); //item.name = "item" + i; arrangeItems(item.transform, x.Value.Random, s); letsUpdate(); } }