Created
February 7, 2013 19:00
-
-
Save cubed2d/4733250 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// attach this to a camera. It sets the sort mode so 2D object are rendered correctly with a perspective camera. | |
public class CameraSortModeSetter : MonoBehaviour | |
{ | |
void Update() | |
{ | |
if (camera != null && camera.transparencySortMode != TransparencySortMode.Orthographic) | |
camera.transparencySortMode = TransparencySortMode.Orthographic; | |
} | |
} | |
// atach this to child cameras in the camera stack. | |
public class CameraSettingSynch : MonoBehaviour | |
{ | |
private Camera parentCamera; | |
private Camera myCamera; | |
// Use this for initialization | |
void Start () | |
{ | |
parentCamera = transform.parent.gameObject.camera; | |
myCamera = camera; // faster if we store this off.. | |
} | |
// Update is called once per frame | |
void Update () | |
{ | |
myCamera.fov = parentCamera.fov; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment