Skip to content

Instantly share code, notes, and snippets.

@baba-s
Created March 25, 2024 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baba-s/e5dd037db7325b3644d6a4e9ba4ec2e7 to your computer and use it in GitHub Desktop.
Save baba-s/e5dd037db7325b3644d6a4e9ba4ec2e7 to your computer and use it in GitHub Desktop.
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