Created
March 25, 2024 02:48
-
-
Save baba-s/e5dd037db7325b3644d6a4e9ba4ec2e7 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
using UnityEditor; | |
using UnityEngine; | |
namespace Kogane.Internal | |
{ | |
[InitializeOnLoad] | |
internal static class MeshRendererOrderInLayerPropertyField | |
{ | |
static MeshRendererOrderInLayerPropertyField() | |
{ | |
_ = new EditorGUIUtility.PropertyCallbackScope( Callback ); | |
static void Callback | |
( | |
Rect rect, | |
SerializedProperty serializedProperty | |
) | |
{ | |
var serializedObject = serializedProperty.serializedObject; | |
if ( serializedObject.targetObject.GetType().Name != nameof( MeshRenderer ) ) return; | |
if ( serializedProperty.propertyPath != "m_DynamicOccludee" ) return; | |
var sortingOrderProperty = serializedObject.FindProperty( "m_SortingOrder" ); | |
sortingOrderProperty.intValue = EditorGUILayout.IntField( "Order in Layer", sortingOrderProperty.intValue ); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment