I’m using SceneManager.LoadAsync to load new levels which are somewhat determined by user input, and I can’t seem to determine how to assess if a scene is valid or not before I load it.
Is there a way to determine if a scene name is valid? I know you can do EditorBuildSettings, but UnityEditor doesn’t function outside of the editor. I need something that will work in a WebGL build.
Simply create a List, add your scene names to that List, and then check if the inputted name is in your List.
For example:
public List<string> TestSceneList;
public string UserInputSceneName;
void TestListVerifier()
{
if (TestSceneList.Contains(UserInputSceneName))
{
Debug.Log("List has a match!");
}
else
{
Debug.Log("INVALID SCENE NAME");
}
}
To add to a list, you can do TestSceneList.Add(“A name”);