我有一個對象列表。他們是Unity場景。如何將對象數組存儲爲一個Unity場景名稱
public Object[] scenes;
我想填補這個數組團結的場面,作爲存儲順序,他們應該團結的檢查中加載的一種便捷方式。
我試圖使用場景管理器使用的參考的水平加載到該陣列
public int currentSceneNumber = 0;
public void LoadNext()
{
if (scenes.Length >= currentSceneNumber + 1)
{
currentSceneNumber += 1;
SceneManager.LoadScene(scenes[currentSceneNumber].ToString());
}
else
{
Debug.Log("Level.cs: Unable to load next level.");
return;
}
}
但轉動場景成一個字符串結果「scenename(UnityEngine.SceneAsset)」的(登錄(UnityEngine。 SceneAsset)是問題的一部分。這將導致以下錯誤
Scene 'prototype02_Scene (UnityEngine.SceneAsset)' couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.
To add a scene to the build settings use the menu File->Build Settings...
如何獲取場景名稱從場景對象在我的數組字符串?
他明確表示,加入所有場景'建立Settings',然後再次檢查你的代碼 – ahmetson