/// <summary>获取所有场景名字</summary>
private string[] getAllSceneName()
{
int count = SceneManager.sceneCountInBuildSettings;
string[] sceneNamesArr = new string[count];
for (int i = 0; i < count; i++)
{
sceneNamesArr[i] = SceneUtility.GetScenePathByBuildIndex(i);
string[] strs = sceneNamesArr[i].Split('/');
string str = strs[strs.Length - 1];
strs = str.Split('.');
str = strs[0];
sceneNamesArr[i] = str;
Debug.Log("场景名字:" + str);
}
return sceneNamesArr;
}
Unity gets the names of all scenes
Guess you like
Origin blog.csdn.net/a451319296/article/details/129098219
Recommended
Ranking