diff --git a/spine-unity/Assets/spine-unity/Editor/SkeletonRendererInspector.cs b/spine-unity/Assets/spine-unity/Editor/SkeletonRendererInspector.cs index 036db53a7..693aee295 100644 --- a/spine-unity/Assets/spine-unity/Editor/SkeletonRendererInspector.cs +++ b/spine-unity/Assets/spine-unity/Editor/SkeletonRendererInspector.cs @@ -53,9 +53,9 @@ public class SkeletonRendererInspector : Editor { front = serializedObject.FindProperty("frontFacing"); if(EditorGUILayoutSortingLayerField == null) - EditorGUILayoutSortingLayerField = typeof(EditorGUILayout).GetMethod("SortingLayerField", BindingFlags.Static | BindingFlags.NonPublic); + EditorGUILayoutSortingLayerField = typeof(EditorGUILayout).GetMethod("SortingLayerField", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof(GUIContent), typeof(SerializedProperty), typeof(GUIStyle) }, null); - rendererSerializedObject = new SerializedObject(((SkeletonRenderer)target).renderer); + rendererSerializedObject = new SerializedObject(((SkeletonRenderer)target).GetComponent()); sortingLayerIDProperty = rendererSerializedObject.FindProperty("m_SortingLayerID"); } @@ -108,7 +108,7 @@ public class SkeletonRendererInspector : Editor { if(renderer != null) { EditorGUI.BeginChangeCheck(); - if(sortingLayerIDProperty != null) { + if(EditorGUILayoutSortingLayerField != null && sortingLayerIDProperty != null) { EditorGUILayoutSortingLayerField.Invoke(null, new object[] { new GUIContent("Sorting Layer"), sortingLayerIDProperty, EditorStyles.popup } ); } else { renderer.sortingLayerID = EditorGUILayout.IntField("Sorting Layer ID", renderer.sortingLayerID);