void BuildLevelSelect() { for (int i = 0; i < _levelNames.Count; i++) { var levelGO = Instantiate(_levelPrefab, transform); levelGO.GetComponentInChildren <Text>().text = (i + 1).ToString(); string levelName = _levelNames[i]; levelGO.GetComponent <Button>().onClick.AddListener(() => _sceneSwapper.StartLoadScene(levelName)); } }
public void WinLevel() { _sceneSwapper.StartLoadScene(_nextLevel); }