using System.Collections;
using System.Collections.Generic;
using UnityEditor.SceneManagement;
using UnityEditor;
using UnityEngine;
namespace ZExtensions
{
/// <summary>
/// 编辑器运行时固定启动场景
/// </summary>
public class PlayModeUseDefaultScene
{
[UnityEditor.MenuItem("BuildTools/PlayModeUseFirstScene")]
static void UpdatePlayModeUseFirstScene()
{
EditorBuildSettingsScene[] scenes = EditorBuildSettings.scenes;
if (scenes.Length > 0)
{
SceneAsset firstScene = AssetDatabase.LoadAssetAtPath<SceneAsset>(scenes[0].path);
if (firstScene != null)
{
EditorSceneManager.playModeStartScene = firstScene;
Debug.Log("Play mode start scene set to: " + firstScene.name);
}
else
{
Debug.LogError("Failed to load the first scene from the build settings.");
}
}
else
{
Debug.LogError("No scenes found in the build settings.");
}
}
}
}
06-29
06-29
06-29
06-29
06-29
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交