|
|
|
|
|
|
{ |
|
|
|
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) |
|
|
|