浏览代码

SceneView Link lock

/main
Thomas ICHÉ 6 年前
当前提交
377c3d91
共有 2 个文件被更改,包括 30 次插入1 次删除
  1. 19
      Editor/GameViewLink/LinkGameView.cs
  2. 12
      Editor/SceneViewToolbar.cs

19
Editor/GameViewLink/LinkGameView.cs


static bool m_Active = false;
public static SceneView LockedSceneView
{
get
{
return s_LockedSceneView;
}
set
{
s_LockedSceneView = value;
}
}
static SceneView s_LockedSceneView;
[InitializeOnLoadMethod]
static void Initialize()
{

if (Active)
{
var sceneCamera = SceneView.lastActiveSceneView.camera;
var sv = s_LockedSceneView == null ? SceneView.lastActiveSceneView : s_LockedSceneView;
var sceneCamera = sv.camera;
var camera = s_GameObject.GetComponent<Camera>();
bool needRepaint = sceneCamera.transform.position != camera.transform.position
|| sceneCamera.transform.rotation != camera.transform.rotation

12
Editor/SceneViewToolbar.cs


EditorApplication.isPlaying = false;
}
bool isLocked = LinkGameView.LockedSceneView == sceneView;
isLocked = GUILayout.Toggle(isLocked, "Lock LinkSceneView", EditorStyles.toolbarButton);
if (GUI.changed)
{
if (isLocked)
LinkGameView.LockedSceneView = sceneView;
else
LinkGameView.LockedSceneView = null;
}
GUILayout.FlexibleSpace();
// Custom Code here

正在加载...
取消
保存