• RuntimesUnity
  • SkeletonGraphic.UpdateMeshMultipleCanvasRenderers problem.

I encountered this issue when I deactivated the object of the ostrich spine.

This is the normal display.

After hiding the riding, we got the errors below.
NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.SkeletonGraphic.UpdateMeshMultipleCanvasRenderers (Spine.Unity.SkeletonRendererInstruction currentInstructions, System.Boolean keepRendererCount) (at Assets/ThirdPart/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs:696)
Spine.Unity.SkeletonGraphic.UpdateMesh (System.Boolean keepRendererCount) (at Assets/ThirdPart/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs:563)
Spine.Unity.SkeletonGraphic.LateUpdate () (at Assets/ThirdPart/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs:319)

    Related Discussions
    ...

    Wecica It seems that this question should be answered by our Unity expert, Harald, but he is currently on vacation and will be gone until January 8th next year. We apologize for the inconvenience, but please wait for his return.

      Misaki Thank you all the same. I will try to fix this problem during this time.

      11 days later

      Wecica After hiding the riding, we got the errors below.

      Sorry for the troubles! How exactly are you hiding the ride? Could you please share both the code you are using, and from where your code gets called (e.g. from Update(), a callback delegate, etc)? Such an issue typically originates if attachments are disabled at the wrong time in the update cycle.

      Also, which version of the spine-unity runtime (name of the unitypackage, also listed in Assets/Spine/version.txt, or alternatively in the Unity Package Manager window) are you using? It looks like you're not using the latest version of either the 4.1 or 4.2-beta runtimes, as the line numbers of your error messages don't fit the code. If you're on 4.1 or 4.2-beta, could you please have a try updating the spine-unity runtime?

        Harald Sorry for the delayed reply, we use version 4.0 of the spine-unity runtime. And it goes null with the code
        "if (useOriginalTextureAndMaterial)
        canvasRenderer.SetMaterial(this.materialForRendering, submeshMaterial.mainTexture);"

        when we hide the MountSpine. The submeshMaterial is null.

        So when we hide the MountSpnie, we check off the "Enable Separation" toggle of HeroSpine by code and everything goes well.
        Thank you, Harald, maybe it's just because we use the "Enable Separation" in the wrong way.

        @Wecica Thanks for getting back to us and for the additional info. If you're using spine-unity 4.0, please check if you're using the latest unitypackage from the download page:
        https://esotericsoftware.com/spine-unity-download#spine-unity-unitypackages
        As always, please be sure to make a backup of your work first before updating the runtime to be on the safe side.

        If the issue persists, I'm afraid we won't publish any bugfixes for the 4.0 runtime any longer, as many bugfixes have already been published in 4.1 and 4.2-beta in the meantime. If you can strip down the issue to a minimal Unity project using the spine-unity 4.1 runtime however (you would need to re-export your skeleton for 4.1 then), we would be happy to have a look at it and fix any potential issues. If you can create such a reproduction Unity project, please send it to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context.