浏览代码

Merge pull request #1894 from Unity-Technologies/lw/package-scene-loader

Added context menu for loading package scenes(LWRP Test Project)
/main
GitHub 6 年前
当前提交
f595457f
共有 3 个文件被更改,包括 21 次插入26 次删除
  1. 21
      TestProjects/LWGraphicsTest/Assets/Editor/LoadPackageSceneContext.cs
  2. 26
      TestProjects/LWGraphicsTest/Assets/Editor/OpenScene.cs
  3. 0
      /TestProjects/LWGraphicsTest/Assets/Editor/LoadPackageSceneContext.cs.meta

21
TestProjects/LWGraphicsTest/Assets/Editor/LoadPackageSceneContext.cs


using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
public class LoadPackageSceneContext : Editor
{
[MenuItem("Assets/Load Package Scene", false, -10)]
private static void LoadPackageScene()
{
var path = AssetDatabase.GetAssetPath(Selection.activeObject);
EditorSceneManager.OpenScene(path);
}
[MenuItem("Assets/Load Package Scene", true)]
private static bool ValidatePackageScene()
{
return Selection.activeObject is SceneAsset;
}
}

26
TestProjects/LWGraphicsTest/Assets/Editor/OpenScene.cs


using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
public class MyWindow : EditorWindow
{
string scene;
// Add menu named "My Window" to the Window menu
[MenuItem("Window/My Window")]
static void Init()
{
// Get existing open window or if none, make a new one:
MyWindow window = (MyWindow)EditorWindow.GetWindow(typeof(MyWindow));
window.Show();
}
void OnGUI()
{
scene = EditorGUILayout.TextField("Scene:", scene);
if (GUILayout.Button("Load"))
EditorSceneManager.OpenScene(scene);
}
}

/TestProjects/LWGraphicsTest/Assets/Editor/OpenScene.cs.meta → /TestProjects/LWGraphicsTest/Assets/Editor/LoadPackageSceneContext.cs.meta

正在加载...
取消
保存