public void DrawScene(Scene loc) { if (loc == null) { return; } // AdsController.Global.LocEvent(); Debug.Log("Drawing " + loc.name); if (OnSceneChanged != null) { OnSceneChanged(); } // Deleting btns from prev loc foreach (Button btn in ButtonsParent.GetComponentsInChildren <Button> ()) { Destroy(btn.gameObject); } SceneText.text = DynamicText.Parse(loc.text); // Rendering new buttons int buttonid = 0; foreach (Action act in loc.actions) { if (!act.ConditionsMet()) { continue; } GameObject actionbutton = Instantiate(ButtonPref, ButtonsParent.transform.position, Quaternion.identity); //.GetComponent<Button>(); actionbutton.transform.SetParent(ButtonsParent); actionbutton.transform.localScale = new Vector3(1, 1, 1); actionbutton.gameObject.GetComponentInChildren <Text> ().text = act.text; act.button = actionbutton.GetComponent <Button>(); actionbutton.GetComponent <ActionButton>().action = act; buttonid++; } }