Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Unity3D is it possible to keep the Scene view focused when hitting Play?

Tags:

ide

unity3d

In Unity3D, when you hit play, by default, it switches to the full 'Game' view which is great for previewing and such, but sometimes we just want to see our results in the 'Scene' view since we don't have to worry about setting up all the lighting, materials, etc.

Now we know we can simply create a new layout that shows both the 'Game' and the 'Scene' tabs at the same time, and that's what we're doing so we can continue to look at the 'Scene' tab when we start. However, we just don't want to see the 'Game' tab at all. Love to just hide it until we need it later.

Can this be done?

like image 718
Mark A. Donohoe Avatar asked Feb 18 '12 01:02

Mark A. Donohoe


People also ask

How do you focus a scene in Unity?

Pressing the “F” key after selecting a game object in the hierarchy or scene window will focus that object in the center of the scene view.

How do I play a game in scene view in Unity?

Scene View NavigationHold the right mouse button to enter Flythrough mode. This turns your mouse and WASD keys (plus Q and E for up and down) into quick first-person view navigation. Select any GameObject and press the F key. This will center the Scene View and pivot point on the selection.

How do you control a scene in Unity?

Use Flythrough mode to navigate the Scene View by flying around in first-person, similar to how you would navigate in many games. Click and hold the right mouse button. Move the view around using the mouse, the WASD keys to move left/right/forward/backward, and the Q and E keys to move up and down.


1 Answers

Place this component on any GameObject and set the KeepSceneViewActive field to true.

using UnityEngine;
using System.Collections;

public class KeepSceneAlive : MonoBehaviour
{
    public bool KeepSceneViewActive;

    void Start()
    {
        if (this.KeepSceneViewActive && Application.isEditor)
        {
            UnityEditor.SceneView.FocusWindowIfItsOpen(typeof(UnityEditor.SceneView));
        }
    }
}
like image 192
null Avatar answered Sep 22 '22 06:09

null