This is going to be a fairly short post. Nothing overly complicated but, hopefully, useful.
Long before Unity3D had built-in 2D capabilities (not that the current 2D implementation is that beneficial to be honest) it was too easy to accidently move the scene camera and toss things out of alignment. Now, I know that fixing the scene to a particular plane and orthographic view can easily be achieved via the little scene gizmo at the top/left of the editing window, this action also requires mouse movement and at least a few button clicks. I prefer hotkeys for common operations. Not to mention that having things available through code allows greater control overall.
The steps to achieve this are not complicated.
- Get the current scene view.
- Set scene view to orthographic.
- Rotate scene view to correct angle.
- Expend scene view to a comfortable size.
I've added that last one in because Unity has a tendency of zooming in too close to things when reset; the comfortable size value itself can be experimented with in order to achieve your own needs. So without further ado; let's see the code.
public static void Perform()
{
var current = SceneView.currentDrawingSceneView;
current.orthographic = true;
current.rotation = Quaternion.Euler(0.0f, 0.0f, 0.0f);
current.size = 2000.0f;
}
The menu item attribute might bear a little more explaining but that'll have to wait for another post.
I guess the winter makes you laugh a little slower, Makes you talk a little lower about the things you could not show her...