void Awake() { this.deleteMovePrompt = GameObject.Find("DeleteMovePrompt"); playText = GameObject.Find("PlayText"); character1 = GameObject.Find("Character 1").GetComponent <MovePlayer>(); //Choose the character to use for animating move previews. character2 = GameObject.Find("Character 2").GetComponent <MovePlayer>(); playTextBehaviour = GameObject.Find("Handler").GetComponent <SceneButtonBehaviour>(); //Used to switch scene by pressing Enter. listSelector = GameObject.Find("Handler").GetComponent <ListSelector>(); }
// Use this for initialization void Start() { text.text = collection.title; GetComponent <Button>().onClick.AddListener(() => { parentMenu.SetActive(false); targetMenu.SetActive(true); foreach (Transform child in targetMenuContent) { Destroy(child.gameObject); } int i = 0; while (true) { string sceneName = collection.prefix + (i + 1).ToString(); if (!Application.CanStreamedLevelBeLoaded(sceneName)) { Debug.Log("Broke at " + sceneName); break; } SceneButtonBehaviour newButton = Instantiate(buttonPrefab, targetMenuContent); RectTransform newRect = newButton.transform as RectTransform; newRect.anchorMin = new Vector2(0.0f, 1.0f); newRect.anchorMax = new Vector2(1.0f, 1.0f); newRect.pivot = new Vector2(0.5f, 1.0f); newRect.anchoredPosition = Vector3.down * 32.0f * i; newButton.target = SceneButtonBehaviour.SceneTarget.Custom; newButton.customSceneName = sceneName; i++; newButton.text.text = string.Format("{0} {1}", collection.title, i); } targetMenuContent.sizeDelta = new Vector2(targetMenuContent.sizeDelta.x, 32.0f * i); }); }