Blender like Camera Orientation Shortcuts

I’m trying to come up with an editor script that will let me change the scene view camera orientation with keypad keys (7 for top, 1 for front and 3 for right views) just like in Blender.

I’m able to get the right camera and get the correct keyboard events, but when I change the rotation of the scene view camera, nothing happens.

Is there a way to do this or better yet a class to access the top right gizmo in the scene view that we use to manipulate the camera orientation and render mode(perspective/orthographic)

Below is my code so far.

using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(Transform))]
public class BlenderCamControl : Editor {
    public void OnSceneGUI() {
        //TODO If no transform selected, select first transform in hierarchy

        Event keyboardEvent = Event.current;

        if(keyboardEvent.isKey) {
            switch(keyboardEvent.keyCode) {
                case KeyCode.Keypad1:
                    Debug.Log(Camera.current.transform.eulerAngles);
                    Camera.current.transform.rotation = Quaternion.Euler(new Vector3(0f, 180f, 0f));
                    break;

                case KeyCode.Keypad3:
                    Camera.current.transform.rotation = Quaternion.Euler(new Vector3(0f, 270f, 0f));
                    break;

                case KeyCode.Keypad7:
                    Camera.current.transform.rotation = Quaternion.Euler(new Vector3(90f, 0f, 0f));
                    break;
            }
        }
    }
}

Solved it, as it turns out there was a class named SceneView in UnityEditor namespace and it’s not documented. I had to change SceneView.lasActiveSceneView.camera and it works.

Sorry for dredging up such an old thread, but I found your script on the Unify wiki. Have you figured out a way to make this work even when no object is selected in the Scene?

Hey, well I actually never even finished the script, someone else did it picking up where I left off. So it would be better to contact him I guess as I didn’t work on it since then.