Hespen
Hespen

Reputation: 1452

How can I force the Unity Editor to the Game View

How can I force the unity editor to show the Game View, instead of my custom editor window on playmode? I have the following code:

void Update(){
  if (EditorApplication.isPlaying)
  {
     FocusWindowIfItsOpen(Type.GetType("UnityEditor.GameView"));
  }
}

I've read that the above should change the focus of the window. However, I can't seem to find the correct Type for this Game View Window. Not even in de docs

Upvotes: 2

Views: 3797

Answers (1)

Leo Smirnov
Leo Smirnov

Reputation: 71

For changing focus to GameView this helped me:

EditorApplication.ExecuteMenuItem("Window/General/Game");

Upvotes: 7

Related Questions