浏览代码

Linked Game view manage in play mode

/main
Thomas ICHÉ 6 年前
当前提交
9cf4e1f5
共有 1 个文件被更改,包括 29 次插入2 次删除
  1. 31
      Editor/GameViewLink/LinkGameView.cs

31
Editor/GameViewLink/LinkGameView.cs


{
get
{
return EditorPrefs.GetBool(kPreferenceName, false);
// Get preference only when not playing
if (!Application.isPlaying)
m_Active = EditorPrefs.GetBool(kPreferenceName, false);
return m_Active;
EditorPrefs.SetBool(kPreferenceName, value);
// Update preference only when not playing
if(!Application.isPlaying)
EditorPrefs.SetBool(kPreferenceName, value);
m_Active = value;
static bool m_Active = false;
EditorApplication.playModeStateChanged += OnPlayModeChanged;
}
static void OnPlayModeChanged(PlayModeStateChange state)
{
if(state == PlayModeStateChange.EnteredEditMode || state == PlayModeStateChange.EnteredPlayMode)
{
if (Active)
Active = true;
else
Active = false;
}
}
const string kMenuPath = "Edit/Link SceneView and GameView %,";

Menu.SetChecked(kMenuPath, Active);
return SceneView.sceneViews.Count > 0;
}
[MenuItem(kMenuSelectPath, priority = kMenuPriority+1)]
static void Select()

s_GameObject = result;
else // Create the camera if it does not exist
s_GameObject = CreateLinkedCamera();
if (Application.isPlaying)
Active = false;
}
if (Active)

正在加载...
取消
保存