- Home /
Control Editor Scene Camera
Is it possible to access the Scene's camera? I can't find anything about it in the reference.
What I'd like to do is to set it to "Back" instead of "Perspective" to get isometric/orthographic(or what could be described as most similar to orthographic) view automatically at certain points of editing. This is to make sure our level editors always get the right perspective as our game is 2D.
Impossible, improbable or doable? :-)
Answer by Joshua · Aug 28, 2011 at 12:23 PM
It's not possible to change the SceneView's camera's perspective. It is, however, already orthonographic by default, so I'm not sure I understand your question.
Ok thanks for clearing that up, not even possible by hack? I'm not very sure what you mean by the camera being orthographic as it doesn't render objects uniformly and has a perspective whilst moving. Switching to left, right, front or back does however render objects without perspective (but render their true size in the perspective). I do feel I get more and more unclear as I go on. :-)
So no go for scene camera controls in Unity, that's good to know!
Perhaps I'm confusing orthographic with isometric here, the camera should always see everything isometric from a zero degree rotation in front position. But as long as we don't have control over the scene view camera via script it doesn't matter.
How about adding another camera that takes over the scene view?
Well you surely can fake your own sceneview by creating an Editor Window, not sure how much trouble this would be but it surely can be done.
"Ok thanks for clearing that up, not even possible by hack?"
Nope, not as far as I can tell. I tried messed around with SceneView.lastActiveSceneView.camera, but it seems as soon as you edit anything it gets reset.
Ok thanks Joshua for the insight and testing. I get pro-shivers when thinking of how constructing our own scene view would build up trouble, it's best to leave it be. :-)
Answer by qbertreynolds · Nov 23, 2012 at 09:59 PM
I'm not sure if the accepted answer is misinformed or just outdated, but it absolutely is possible to programmatically change the scene view camera's projection.
SceneView.lastActiveSceneView.orthographic = true;
To set it to a back view
SceneView.lastActiveSceneView.LookAt(SceneView.lastActiveSceneView.pivot, Quaternion.LookRotation(Vector3.forward));
Your answer