x


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?

more ▼

asked Apr 01 '11 at 12:18 PM

saig gravatar image

saig
23 2 2 6

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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();
}
more ▼

answered Apr 01 '11 at 02:22 PM

Bunny83 gravatar image

Bunny83
45.4k 11 49 207

(comments are locked)
10|3000 characters needed characters left
more ▼

answered Apr 01 '11 at 12:29 PM

e.bonneville gravatar image

e.bonneville
5.7k 100 116 165

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1674
x718
x90
x85
x63

asked: Apr 01 '11 at 12:18 PM

Seen: 1570 times

Last Updated: Apr 01 '11 at 12:18 PM