Hi!
I am using a perspective camera to get a parallax effect in game. However, I had to use the follow line of code to get the camera to sort by Z in game, instead of distance (i.e. perspective sort mode):
GetComponent().transparencySortMode = TransparencySortMode.Orthographic;
The problem is, I don’t know how to do this for the editor camera. This means that the editor in the camera will not show the world/scene how it would look in-game. How do I fix this?
Super-late response, but I’ve finally found a solution for this one! Create a new file in the Editor folder with the following code; it will add a new menu that will allow you to switch between sort modes of the editor camera:
using UnityEditor;
using UnityEngine;
public static class CameraMenu
{
public static class Camera
{
[MenuItem("Camera/Orthographic")]
static public void OrthographicCamera()
{
Camera cam = SceneView.lastActiveSceneView.camera;
cam.transparencySortMode = TransparencySortMode.Orthographic;
}
[MenuItem("Camera/Perspective")]
static public void PerspectiveCamera()
{
Camera cam = SceneView.lastActiveSceneView.camera;
cam.transparencySortMode = TransparencySortMode.Default;
}
}
}
Worked for me on v5.5.1f1.