Skip to content

Instantly share code, notes, and snippets.

@McNull
Created August 7, 2018 13:52
Show Gist options
  • Save McNull/48a55a6bc405398db48fe0a99287790b to your computer and use it in GitHub Desktop.
Save McNull/48a55a6bc405398db48fe0a99287790b to your computer and use it in GitHub Desktop.
Unity component that keeps the editor scene view active when entering play mode.
using UnityEngine;
/// <summary>
/// Keeps the editor scene view active when entering play mode.
/// Place this component on any game object.
/// </summary>
public class KeepSceneViewActive : MonoBehaviour
{
[Tooltip("Keep the editor scene view active")]
public bool KeepActive = true;
#if UNITY_EDITOR
void Start()
{
if (this.KeepActive && Application.isEditor)
{
UnityEditor.EditorWindow.FocusWindowIfItsOpen(typeof(UnityEditor.SceneView));
}
}
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment