Merge branch 'master' of https://gitlab.nicholasnovak.io/fums/ofb
This commit is contained in:
@@ -6,6 +6,8 @@ using TMPro;
|
||||
|
||||
public class DebugSceneSwitcher : MonoBehaviour
|
||||
{
|
||||
public bool showDropdown;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
// Keep the object around when we switch scenes
|
||||
@@ -16,16 +18,20 @@ public class DebugSceneSwitcher : MonoBehaviour
|
||||
void CreateDropdownOptions()
|
||||
{
|
||||
TMP_Dropdown sceneDropdown = GameObject.Find("SceneSwitcherDropdown").GetComponent<TMP_Dropdown>();
|
||||
if (sceneDropdown.options.Count == 0)
|
||||
{
|
||||
List<string> sceneNames = new List<string>();
|
||||
for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++)
|
||||
if (showDropdown) {
|
||||
if (sceneDropdown.options.Count == 0)
|
||||
{
|
||||
string newName = System.IO.Path.GetFileNameWithoutExtension(SceneUtility.GetScenePathByBuildIndex(i));
|
||||
print(newName);
|
||||
sceneNames.Add(newName);
|
||||
List<string> sceneNames = new List<string>();
|
||||
for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++)
|
||||
{
|
||||
string newName = System.IO.Path.GetFileNameWithoutExtension(SceneUtility.GetScenePathByBuildIndex(i));
|
||||
print(newName);
|
||||
sceneNames.Add(newName);
|
||||
}
|
||||
sceneDropdown.AddOptions(sceneNames);
|
||||
}
|
||||
sceneDropdown.AddOptions(sceneNames);
|
||||
} else {
|
||||
sceneDropdown.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,4 +41,9 @@ public class DebugSceneSwitcher : MonoBehaviour
|
||||
SceneController.Instance.LoadChosenScene(index);
|
||||
this.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void ChangeSceneByName(string name) {
|
||||
SceneController.Instance.LoadSceneByName(name);
|
||||
this.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,4 +50,8 @@ public class SceneController : MonoBehaviour
|
||||
SceneManager.LoadScene(index);
|
||||
}
|
||||
|
||||
public void LoadSceneByName(string name) {
|
||||
SceneManager.LoadScene(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,7 +49,9 @@ public class StateController : MonoBehaviour
|
||||
}
|
||||
DontDestroyOnLoad(this.gameObject);
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
}
|
||||
|
||||
void Start() {
|
||||
if (this.inDebugMode)
|
||||
{
|
||||
debugCanvas = GameObject.Find("DebugCanvas");
|
||||
|
||||
Reference in New Issue
Block a user