Created
November 4, 2016 09:04
-
-
Save QXSoftware/1821915377e333e45f7a632ae07e64aa to your computer and use it in GitHub Desktop.
Camera inspector to modify opaqueSortMode and transparencySortMode
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using UnityEditor; | |
using UnityEngine; | |
using UnityEngine.Rendering; | |
[CustomEditor(typeof(Camera), true)] | |
public class CameraInspector : Editor | |
{ | |
public override void OnInspectorGUI() | |
{ | |
base.OnInspectorGUI(); | |
DrawSortMode(); | |
} | |
private void DrawSortMode() | |
{ | |
GUILayout.Space(6); | |
var cam = (Camera)target; | |
GUILayout.BeginVertical("box"); | |
EditorGUI.BeginChangeCheck(); | |
var opaqueSortMode = (OpaqueSortMode)EditorGUILayout.EnumPopup("OpaqueSortMode", cam.opaqueSortMode); | |
if (EditorGUI.EndChangeCheck()) | |
{ | |
cam.opaqueSortMode = opaqueSortMode; | |
EditorUtility.SetDirty(cam); | |
} | |
EditorGUI.BeginChangeCheck(); | |
var transparencySortMode = (TransparencySortMode)EditorGUILayout.EnumPopup("TransparencySortMode", cam.transparencySortMode); | |
if (EditorGUI.EndChangeCheck()) | |
{ | |
cam.transparencySortMode = transparencySortMode; | |
EditorUtility.SetDirty(cam); | |
} | |
GUILayout.EndVertical(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment