- Home /
How can I Select/focus the SceneView in Editor?
Hi,
How can I Select/focus the SceneView in Editor?
I want to focus automatically on the Sceneview when clicking a button in my custom InspectorGUI.
But i can't find an solution to that ... can anybody help me with that?
Answer by Bunny83 · Apr 01, 2011 at 02:22 PM
Unfortunately the SceneView class is not documented. If you use Microsoft Visual C# you have IntelliSense which gives you all you need. SceneView.sceneViews
is an static ArrayList that contains all open SceneViews (keep in mind there can be more than one). SceneView inherits from EditorWindow so every SceneView have a Focus()
function like Elliot said. To focus the first available SceneView do something like:
// JS if (SceneView.sceneViews.Count > 0) { var sceneView : SceneView = SceneView.sceneViews[0]; sceneView.Focus(); }
// C# if (SceneView.sceneViews.Count > 0) { SceneView sceneView = (SceneView)SceneView.sceneViews[0]; sceneView.Focus(); }
Your answer
Follow this Question
Related Questions
Hold Right-Click + "W" or "S" in Scene Editor not working properly!! 1 Answer
Setting the SceneView View Angle/Position? 1 Answer
How can I make a custom 3d editor within the Unity editor? 1 Answer
unity: scene shows nothing, PLEASE HELP 1 Answer
'Resource file has already been unloaded' error when exiting application in Editor 1 Answer