foreach (UnityEditor.EditorBuildSettingsScene S in UnityEditor.EditorBuildSettings.scenes)
{
//在built setting中是否已经开启
if(S.enabled)
{
//得到场景的名称
string name = S.path;
//打开这个场景
EditorApplication.OpenScene(name);
//遍历场景中的GameObject
foreach (GameObject obj in Object.FindObjectsOfType(typeof(GameObject)))
{
}
}
}
转载于:https://blog.51cto.com/568464209/1759771