Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Staying in scene view after pressing play

Discussion in 'UGUI & TextMesh Pro' started by doev, Dec 26, 2015.

  1. doev

    doev

    Joined:
    Dec 19, 2015
    Posts:
    8
    Always after I press play the Editor switch to game view. But I want to stay in scene view. In the tutorial videos I saw that this is possible, but how?
     
  2. codeedward

    codeedward

    Joined:
    Dec 19, 2014
    Posts:
    93
    Found on stack overflow and checked in unity:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class KeepSceneAliveScript : MonoBehaviour
    5. {
    6.     public bool KeepSceneViewActive;
    7.  
    8.     void Start()
    9.     {
    10.         if (this.KeepSceneViewActive && Application.isEditor)
    11.         {
    12.             UnityEditor.SceneView.FocusWindowIfItsOpen(typeof(UnityEditor.SceneView));
    13.         }
    14.     }
    15. }
     
  3. doev

    doev

    Joined:
    Dec 19, 2015
    Posts:
    8
    The script is working fine. Thank you.
     
  4. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    303
    This script is making Unity Crash