API for SceneView class

Where can I find API documentation for Unity SceneView class? I can see it being used in some extensions but it’s nowhere to be found in Unity API.

Example usage: SceneView view = SceneView.currentDrawingSceneView;

1 Answer

1

There is currently no official documentation for SceneView class, but I think they are going to publish some, in fact they have moved some classes from UnityEditorInternal to UnityEditor.BlendTree in unity 5.

I hope they will do the same with SceneView, for now you can use a Reflector (for example ILSpy) or Visual Studio’s autocomplete feature (that shows avaliable methods and properties in a dropdown list) and experiment a bit trying using this functions.

I have managed to achieve simple results like this:

//focuses view on certain point in scene view
    public static void focusPositon(Vector3 position)
    {
        Object[] prevSelected = Selection.objects; //saves selection
        GameObject o = new GameObject(); //creates a new object
        o.transform.position = position; //in specified position
        Selection.activeGameObject = o; //selects it
        SceneView.lastActiveSceneView.FrameSelected(); //focuses on selection
        MonoBehaviour.DestroyImmediate(o); //destroys object
        Selection.objects = prevSelected; //and restores selected objects
    }

Also, you could find something in unity forums. http://forum.unity3d.com/

three years later and it's still not documented, however this answer was super helpful