mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Fixed Exception at SetIconForObject with Unity 2021.2. Closes #2141.
This commit is contained in:
parent
3d2484697a
commit
ecf5418a25
@ -31,6 +31,10 @@
|
|||||||
#define NEW_PREFAB_SYSTEM
|
#define NEW_PREFAB_SYSTEM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if UNITY_2021_2_OR_NEWER
|
||||||
|
#define PUBLIC_SET_ICON_FOR_OBJECT
|
||||||
|
#endif
|
||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -145,11 +149,14 @@ namespace Spine.Unity.Editor {
|
|||||||
icon = Icons.constraintNib;
|
icon = Icons.constraintNib;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#if PUBLIC_SET_ICON_FOR_OBJECT
|
||||||
|
EditorGUIUtility.SetIconForObject(boneComponent.gameObject, icon);
|
||||||
|
#else
|
||||||
typeof(EditorGUIUtility).InvokeMember("SetIconForObject", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.NonPublic, null, null, new object[2] {
|
typeof(EditorGUIUtility).InvokeMember("SetIconForObject", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.NonPublic, null, null, new object[2] {
|
||||||
boneComponent.gameObject,
|
boneComponent.gameObject,
|
||||||
icon
|
icon
|
||||||
});
|
});
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AttachIconsToChildren (Transform root) {
|
static void AttachIconsToChildren (Transform root) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user