Jamez0r

Hey Harald and everyone 8)

This happened a while ago, I believe before we updated to Spine 4.0. One of our characters lost the reference to their Mesh on their Mesh Filter in their Prefab, so in the Editor the character is invisible. It only happened with this character.



The character is using a Render Separator, and the Parts Renderers are also missing the reference (also says "None" in the Mesh Filter).



If I run the game, the Mesh is linked up properly and everything works/looks fine.

Is there a way to refresh things so that the Mesh Filter gets the reference back?

Things I've tried:
1) Disabling and re-enabling the Skeleton Render Separator.
2) Pressing "Reload" on the Skeleton Animation.
3) If I create a new Skeleton Animation from the character's Skeleton Data asset, it looks fine (so something just got jumbled up with this particular Prefab).

If its possible to get the Mesh linked back up without deleting and re-creating any components, that would be nice (so I don't have to re-establish a bunch of other references) - but if not, I could try recreating whichever components are suggested.

Thanks for any help/suggestions!
アバター
Jamez0r
  • 記事: 287

Harald

The main GameObject with the SkeletonRenderSeparator is expected to have the Mesh and MeshFilter cleared, that is intentional. However the child SkeletonPartsRenderer GameObjects should not have empty meshes, this is indeed strange.

You could have a try disabling and re-enabling the SkeletonRenderSeparator, or enabling and disabling SkeletonAnimation Advanced - Fix Prefab Override MeshFilter.

If this does not resolve the issue, could you please send us the problematic Unity assets as a zip package to contact@esotericsoftware.com, then we can have a look at what's going wrong.
アバター
Harald

Harri
  • 記事: 3353

Jamez0r

Thanks Harald!
Harald さんが書きました:You could have a try disabling and re-enabling the SkeletonRenderSeparator, or enabling and disabling SkeletonAnimation Advanced - Fix Prefab Override MeshFilter.
Tried disabling/enabling the SkeletonRenderSeparator, unfortunately didn't fix it.

I didn't have the "Fix Prefab Override MeshFilter" option in my version, so I updated to the newest version and gave it a try - also didn't work unfortunately.

I stripped down the Prefab for the character that is having the issue so that it is basically just the SkeletonAnimation/Mesh/SkeletonRenderSeparator stuff and tried a few things with that - even if I completely remove/delete anything related to the SkeletonRenderSeparator, and then re-create it, it still has the issue.
Harald さんが書きました:If this does not resolve the issue, could you please send us the problematic Unity assets as a zip package to contact@esotericsoftware.com, then we can have a look at what's going wrong.
Gonna send this to you guys in just a minute - I haven't done any "unity package" stuff before, so I apologize if I did anything wrong with it. I basically right-clicked on the problematic Prefab, and did Export Package. It had a ton of referenced stuff that it wanted to include, so I removed everything except the spine-assets, and the spine runtime stuff. If I need to do anything differently let me know!

Also I am not in a rush to fix this. It is only a single character, and they are only invisible in Scene view in editor mode, so it isn't urgent. But would definitely like to figure it out sooner or later :D

I'm using Unity version 2020.2.1f1 in case it matters, and the Spine Runtime is the newest version (spine-unity-4.0-2021-09-01.unitypackage).

--

Also a separate thing I wanted to ask about - when I updated to this newest version of the Spine Runtime, I got a flood of warnings about "unique identifiers":


Is this something to worry about? In all of our prefabs, we name the gameobject that has the SkeletonAnimation "SpineFront" for the frontside view and "SpineBack" for the backside view.

Thanks a lot Harald!!
アバター
Jamez0r
  • 記事: 287

Harald

Jamez0r さんが書きました:Is this something to worry about? In all of our prefabs, we name the gameobject that has the SkeletonAnimation "SpineFront" for the frontside view and "SpineBack" for the backside view.
I haven't encountered this problem yet. Do you also receive this error when re-importing a single prefab with a single Skeleton? Or does this only happen when re-importing multiple prefabs or a prefab contaiing multiple skeletons?
Jamez0r さんが書きました:Gonna send this to you guys in just a minute - I haven't done any "unity package" stuff before, so I apologize if I did anything wrong with it. I basically right-clicked on the problematic Prefab, and did Export Package. It had a ton of referenced stuff that it wanted to include, so I removed everything except the spine-assets, and the spine runtime stuff. If I need to do anything differently let me know!
Thanks for sending the repro package! We will have a look at it soon and get back to you as soon as we've figured out the cause of the problem.
アバター
Harald

Harri
  • 記事: 3353

vhristov

Harald さんが書きました:Is this something to worry about? In all of our prefabs, we name the gameobject that has the SkeletonAnimation "SpineFront" for the frontside view and "SpineBack" for the backside view.
I accidentally got this myself today. It happened because I created two spine game objects with the same name (in my case it was by mistake).
Do you have multiple "SpineFront" game objects inside a single prefab ? If yes - this is caused by the way prefab meshes are saved here:
string meshName = string.Format("Skeleton Prefab Mesh \"{0}\"", renderer.name);
It causes a name collision if multiple renderers share the same name when trying to save it to the prefab asset.
It is not something to worry about, but you will most certainly get a broken prefab preview thumbnail.
On the other hand it could get quite annoying as every time it will show up as warning when saving the prefab (I do this manually but I guess some people are using the "auto save" which could produce even more noise?).

P.S.
Since recently, you are able to delete the spine's meshFilter from the game objects and it will get recreated on the next repaint. I am curious if this will fix the preview (of course in case you don't have a reference to the filter itself)
vhristov
  • 記事: 36

Jamez0r

Hey Vhristov, thanks for the reply/info !
vhristov さんが書きました:I accidentally got this myself today. It happened because I created two spine game objects with the same name (in my case it was by mistake).
Do you have multiple "SpineFront" game objects inside a single prefab ? If yes - this is caused by the way prefab meshes are saved here:
string meshName = string.Format("Skeleton Prefab Mesh \"{0}\"", renderer.name);
It causes a name collision if multiple renderers share the same name when trying to save it to the prefab asset.
It is not something to worry about, but you will most certainly get a broken prefab preview thumbnail.
On the other hand it could get quite annoying as every time it will show up as warning when saving the prefab (I do this manually but I guess some people are using the "auto save" which could produce even more noise?).
Hmm, I shouldn't have any prefabs that have multiple SkeletonAnimations/renderers with the same gameobject name "SpineFront" inside them. Each of my character prefabs have a single "SpineFront" gameobject.

Side question though - if I had a prefab for lets say, a little mockup of an area of my game, and this prefab had multiple character prefabs INSIDE of it... would that trigger this warning? I honestly am not sure if prefabs like that exist in my project... the warning doesn't really give any info on the location/origin of the prefabs/gameobjects in question, so I have no idea how to track down what is actually going on lol.


I also save my prefabs manually, and with this particular character (the one I made this thread about), when I save the prefab I get 82 Warnings. About 75 of them are all the same - the warning in the screenshot above, and then a couple of them have other names instead of "SpineFront" (different names that I have for the gameobject that has the SkeletonAnimation stuff).

Hmm, something strange seems to be going on though - I just tested two things:
1) I opened another character who has a "SpineFront" SkeletonAnimation gameobject, and made a change and saved the prefab - didn't get any Warnings.
2) Duplicated the original character's prefab (that this thread was about), then opened that new prefab and made a change and saved it - didn't get any Warnings. :think: :think: :think:

Not really sure whats going on there, but would be glad to test anything out if you guys have any thoughts!
vhristov さんが書きました:P.S.
Since recently, you are able to delete the spine's meshFilter from the game objects and it will get recreated on the next repaint. I am curious if this will fix the preview (of course in case you don't have a reference to the filter itself)
Interesting idea, I tried the following:
1) Deleting the meshFilter on the gameobject with the PartsRenderer - it didn't allow it (PartsRenderer "RequireComponent" of MeshFilter). I removed that RequireComponent setting in the code, and then deleted it, but it didn't recreate the meshFilter.
2) Disabled the SkeletonRenderSeparator on my SkeletonAnimation gameobject, then deleted the meshFilter - it recreated the meshFilter but it was still "None" for the Mesh.
3) Then I completely removed all components/gameobjects related to the SkeletonRenderSeparator (the meshFilter on the SkeletonAnimation gameobject was still "None" so it was still invisible at this point). I then deleted the meshFilter and it recreated it AND had the mesh, and was then VISIBLE and had the mesh linked up properly.
4) Then I manually recreated the SkeletonRenderSeparator setup, and the PartsRenderers gameobject's meshFilter was "None" again :'(

Worth the try though :lol:
アバター
Jamez0r
  • 記事: 287

vhristov

Jamez0r さんが書きました:Side question though - if I had a prefab for lets say, a little mockup of an area of my game, and this prefab had multiple character prefabs INSIDE of it... would that trigger this warning?
This is definitely possible. I just tested it on my side and it also triggers a warning:
Screenshot from 2021-09-14 09-46-59.png

I added the prefab 3 times in a new game object and it got 2 warnings per spine renderer when I edited and saved the nested prefab:
Screenshot from 2021-09-14 09-50-18.png

"Variant 1" is one prefab, "Variant" and "Variant (1)" are another prefab. Each of them are containing the same kind of objects with 3 skeleton animations: SpineSkeleton, Bullet and StunEffect

The two options I can see are:
1. Adding an index in the mesh name
2. Somehow sharing the mesh between objects.
I am not sure the second options is possible and that it will not cause side effects (I doubt it can be guessed with 100% certainty that the colliding mesh names are the same. I definitely have different skeletons attached to the same game object with the same name in different prefab variants.

The weird thing is that I just tried to create a skeleton render separator and it did not saved any mesh inside the prefab, so that shall not cause any warnings at all (and if I understood you correctly "SpineFront" is separated skeleton?)
Also unexpected (for me) was that I had meshFilter with sharedMesh attached to the SkeletonRenderer/SkeletonRenderSeparator, while I expected it to be cleared and only the PartRenderers to have valid meshfilters.
I definitely don't understand how this works :think:
添付ファイルを見るにはパーミッションが必要です
vhristov
  • 記事: 36

Jamez0r

Concerning the original topic - I may have found what might have led to the Mesh Filter lost reference - I was using "Update When Invisible - Only Animation Status" for this character (they have a front-side and a back-side skeleton, so I swap between the two based on which direction the character is facing).

I just switched the character back to Update When Invisible - Full Update, and now I see the character in prefab mode. To be honest, I didn't notice immediately, so there is a chance that something else caused the character to re-appear, but I noticed it maybe 5 or 10 minutes after I had changed that setting :think:

I wonder if the skeleton had somehow thought it was invisible for some reason in Editor mode? :think: Switching back to "Update When Invisible - Only Animation Status" does not cause the character to disappear again.

Since it is fixed now, and it was probably a one-off / fluke that got the character into that weird state, I would say we can probably consider my original issue "fixed". If I notice it happen again with another character than I'll try to post more info :yes:

---

(Quick additional update)

I just opened up the zipped unity assets that I sent Harald (which had the initial problem) and was able to fix it by setting "Update When Invisible - Full Update", and then disabling and re-enabling the Skeleton Render Separator. So that does seem to fix the issue! Not sure what may have caused it in the first place, but thats a super easy fix :grinteeth:
アバター
Jamez0r
  • 記事: 287

Harald

Sorry for the late reply, just arrived back from having a week off.

These are great news @Jamez0r! Thanks so much for investigating and for sharing the bugfix! :cooldoge:
アバター
Harald

Harri
  • 記事: 3353

Jamez0r

The Bad News: The issue where the character becomes invisible happened again.

The Good News: I figured out how to re-create the issue :p

Posted an issue ticket here: https://github.com/EsotericSoftware/spine-runtimes/issues/1960
アバター
Jamez0r
  • 記事: 287

Harald

Sorry to hear it happened again! :wounded: Thanks for reporting once again with a nicely written issue ticket, glad it could be reproduced! :nerd: I will post here on the forum once we have a bugfix ready.
アバター
Harald

Harri
  • 記事: 3353


Return to Unity