mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
确保Launcher打开的main场景,而不是其他名称里包含main的场景。
This commit is contained in:
@@ -72,7 +72,23 @@ namespace TEngine
|
||||
}
|
||||
else
|
||||
{
|
||||
string scenePath = AssetDatabase.GUIDToAssetPath(guids[0]);
|
||||
string scenePath = null;
|
||||
// 优先打开完全匹配_sceneToOpen的场景
|
||||
for (var i = 0; i < guids.Length; i++)
|
||||
{
|
||||
scenePath = AssetDatabase.GUIDToAssetPath(guids[i]);
|
||||
if (scenePath.EndsWith("/" + _sceneToOpen + ".unity"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有完全匹配的场景,默认显示找到的第一个场景
|
||||
if (string.IsNullOrEmpty(scenePath))
|
||||
{
|
||||
scenePath = AssetDatabase.GUIDToAssetPath(guids[0]);
|
||||
}
|
||||
|
||||
EditorSceneManager.OpenScene(scenePath);
|
||||
EditorApplication.isPlaying = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user