我有一个对象列表。他们是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