private void LoadButtons() { if (content == null) { return; } if (levelSelectButton == null) { return; } if (levelList == null) { SetupLevelList(); } List <RawLevel> levels = levelList.data.levels; foreach (RawLevel level in levels) { GameObject newBtn = Instantiate(levelSelectButton); ControllerButtonSelectLevel cont = newBtn.GetComponentInChildren <ControllerButtonSelectLevel>(); cont.levelName = level.name; cont.levelpath = level.path; StartGameplayButtonMenu startGameply = newBtn.GetComponentInChildren <StartGameplayButtonMenu>(); startGameply.path = level.path; newBtn.transform.SetParent(content, false); newBtn.SetActive(true); } content.sizeDelta = new Vector2(content.sizeDelta.x, 80 * (levels.Count + 1)); }
private void OnEnable() { StartGameplayButtonMenu script = GetComponentInChildren <StartGameplayButtonMenu>(); string path = SingletonJsonLoadable <ConfigurationLevelDataPair> .Instance.data.nextLevelPath; if (path == "") { parent.SetActive(false); return; } script.enabled = true; script.path = path; }