giden


public static void AttachIcon (SkeletonUtilityBone boneComponent) {
Skeleton skeleton = boneComponent.hierarchy.Skeleton;
Texture2D icon = boneComponent.bone.Data.Length == 0 ? Icons.nullBone : Icons.boneNib;

foreach (IkConstraint c in skeleton.IkConstraints)
if (c.Target == boneComponent.bone) {
icon = Icons.constraintNib;
break;
}
typeof(EditorGUIUtility).InvokeMember("SetIconForObject", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.NonPublic, null, null, new object[2] {
boneComponent.gameObject,
icon
});
}
My Package version: spine-unity-4.1-2022-08-19.unitypackage
My Unity version : Unity 2021.3.2f1

EditorGUIUtility.SetIconForObject is public method(unity 2021.2 or newer)
it throw error.
MissingMethodException: Method 'UnityEditor.EditorGUIUtility.SetIconForObject' not found.
System.RuntimeType.InvokeMember (System.String name, System.Reflection.BindingFlags bindingFlags, System.Reflection.Binder binder, System.Object target, System.Object[] providedArgs, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, System.String[] namedParams) (at <6073cf49ed704e958b8a66d540dea948>:0)
System.Type.InvokeMember (System.String name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object target, System.Object[] args) (at <6073cf49ed704e958b8a66d540dea948>:0)
Spine.Unity.Editor.SkeletonUtilityInspector.AttachIcon (Spine.Unity.SkeletonUtilityBone boneComponent) (at Assets/03_AssetStore/Spine/Editor/spine-unity/Editor/Components/SkeletonUtilityInspector.cs:153)
it need to fix this.
public static void AttachIcon (SkeletonUtilityBone boneComponent) {
Skeleton skeleton = boneComponent.hierarchy.Skeleton;
Texture2D icon = boneComponent.bone.Data.Length == 0 ? Icons.nullBone : Icons.boneNib;

foreach (IkConstraint c in skeleton.IkConstraints)
if (c.Target == boneComponent.bone) {
icon = Icons.constraintNib;
break;
}

#if UNITY_2021_2_OR_NEWER
EditorGUIUtility.SetIconForObject(boneComponent.gameObject, icon);

#else
typeof(EditorGUIUtility).InvokeMember("SetIconForObject", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.NonPublic, null, null, new object[2] {
boneComponent.gameObject,
icon
});
#endif

}
giden
  • Posts: 1

Harald

Thanks for reporting and sorry for the troubles!

We have fixed the issue on the 4.1 branch, a new spine-unity 4.1 unitypackage is available for download here as usual:
spine-unity Download

Issue ticket URL for later reference:
https://github.com/EsotericSoftware/spine-runtimes/issues/2141
User avatar
Harald

Harri
  • Posts: 4459


Return to Unity