Hi,
Anyone who might have an idea what could cause this or how to fix it ?

When I set a Mask on a Spine object, I get warning spam.
The warning comes only in Editor (not in play mode) and only when Spine object is selected AND only if a Mask is set.

Console output:
No materials found assigned at Spine GameObject (skeleton)
UnityEngine.Debug:LogWarning (object)
Spine.Unity.Editor.SpineMaskUtilities:EditorConfirmDisabledMaskMaterialsInit (Spine.Unity.SkeletonRenderer) (at Assets/ThirdParty/Spine/Editor/spine-unity/Editor/Utility/SpineMaskUtilities.cs:187)
Spine.Unity.Editor.SpineMaskUtilities:EditorInitSpriteMaskMaterialsForMaskType (Spine.Unity.SkeletonRenderer,UnityEngine.Rendering.CompareFunction,UnityEngine.Material[]&) (at Assets/ThirdParty/Spine/Editor/spine-unity/Editor/Utility/SpineMaskUtilities.cs:157)
Spine.Unity.Editor.SpineMaskUtilities:EditorInitSpriteMaskMaterialsOutsideMask (Spine.Unity.SkeletonRenderer) (at Assets/ThirdParty/Spine/Editor/spine-unity/Editor/Utility/SpineMaskUtilities.cs:151)
Spine.Unity.Editor.SpineMaskUtilities:EditorAssignSpriteMaskMaterials (Spine.Unity.SkeletonRenderer) (at Assets/ThirdParty/Spine/Editor/spine-unity/Editor/Utility/SpineMaskUtilities.cs:83)
Spine.Unity.Editor.SpineEditorUtilities:ReinitializeComponent (Spine.Unity.SkeletonRenderer) (at Assets/ThirdParty/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs:310)
Spine.Unity.Editor.SkeletonRendererInspector😮nInspectorGUI () (at Assets/ThirdParty/Spine/Editor/spine-unity/Editor/Components/SkeletonRendererInspector.cs:197)
UnityEngine.GUIUtility😛rocessEvent (int,intptr,bool&)

  • What I can tell is, we have Spines from two previous games, that both works fine with masks when I test them (same mask png, same project).
  • For those that work, when choose a Mask the scripts generate a _OutsideMask material. However, for the spine that gives the warning spam, it does not generate this material (I would guess that the warning has something to do with this?).
  • When the problematic spine is imported it does create a material as expected, but it does not set any material(s) on the Mesh Renderer (the working ones does).
  • In play mode there seem to be no problems, no warnings and the masks work, so it may be a case of "don't worry dude", but since it is my job to worry 😃, and also I find it suspicious that the _OutsideMask material is not generated.
  • Tried going through all the export settings in Spine with our graphic designers, replicating all settings from the previous projects but with no change.

Any ideas or suggestions ?
Should I apply "why worry if it works at runtime" ?

We use version 4.1 of the Unity spine lib and Unity 2023.1.0b8.
Let me know if you need more info.

Cheers
Janus Kjempff

Related Discussions
...

Which exact version of the spine-unity 4.1 runtime are you using? It's the date in the name of the unitypackage, also found in Assets/Spine/version.txt. Alternatively, you could check the version displayed in the Unity Package Manager if you have installed the runtime this way. In any way, please always be sure to check whether the latest runtime from the download page resolves your issue, if you're not already using it.

In your case I assume that the problem won't be resolved by a package update. Could you please check whether this issue occurs in a clean Unity project as well with just the spine-runtime and your problematic skeleton assets added? If so, could you please send us a this minimal Unity project as a zip package, to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context.

BTW, you can add triple-backticks before and after code sections to format it properly and avoid emojis in the middle of your code as shown below 🙂.

```
your code
```
4 天 后

@kjempff Thanks for sending the reproduction project. Unfortunately we could not reproduce the issue with your project, we didn't get any warning spam when following your description in the email. When selecting the mask GameObject in the Sample Scene we received only a single different warning, which is justified however:

Assets/ProblematicFiles/skeleton.png` and material `skeleton_Material.mat` : IncorrectTexture / Material Settings found: It is strongly recommended to enable `Alpha Is Transparency` on `Straight alpha` textures.
Assuming `Straight alpha` texture because `Straight Alpha Texture` is enabled at material). (You can disable this warning in `Edit - Preferences - Spine`)

We tested with Unity 2023.9.f1 however, while your project was initially set to 2023.1.0b8. In general it's not recommended to use beta Unity versions when there are newer non-beta release versions available. Could you please check if the problem is resolved with a newer Unity version?

Just to be sure we are doing the same thing.
I didn't mean select the mask GameObject.
I meant select mask (Inside or Outside mask) on the Skeleton animation.

Does Spine generate the _OutsideMask.material when you test it ? We don't get an _OusideMask.material generated when we try it, but on the Spines from previous project it does generate one - Is it needed for masking ? as I said it seem to work fine in play mode without it.

I can try it on a newer Unity version .. bit busy, might be a few days.

@kjempff Oh, I see, I misunderstood your description:
"To reproduce: Select mask in the spine GameObject and the warning spam should start."
You meant _"SetMask Interaction at the SkeletonAnimation component to Visible Outside Mask". Please always take the time to write exactly what you are doing in the reproduction steps, not what you think you're approximately doing. 🙂 We could now reproduce the problem and we'll investigate the issue.

@kjempff We have just released a bugfix for this issue. The problem was related to the assigned skin having no attachments visible (thus the materials array being of size 0) while the animation was applied after the mask materials are generated. We have now fixed both the warning as well as applying the active animation before generating mask materials.

New 4.1 and 4.2-beta spine-unity unitypackages are available for download here as usual:
https://esotericsoftware.com/spine-unity-download
Please let us know if this resolves the issues on your end as well. Thanks for reporting!

Issue ticket URL for later reference:
EsotericSoftware/spine-runtimes2363

2 个月 后

Forgot to reply back then, but I can confirm that the new packages fixed the issue.
Thanks for the exceptionally quick response and fix.

@kjempff No problem. Thanks for getting back to us, glad it helped.