Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Unity] SkeletonGhostPartsRenderer.cs sharedMesh null check #2074

Closed
Jamez0r opened this issue May 3, 2022 · 3 comments
Closed

[Unity] SkeletonGhostPartsRenderer.cs sharedMesh null check #2074

Jamez0r opened this issue May 3, 2022 · 3 comments
Assignees
Labels

Comments

@Jamez0r
Copy link

Jamez0r commented May 3, 2022

Found a corner-case issue that results in a null-pointer in this situation:

SkeletonPartsRenderer gameobject with a SkeletonGhostPartsRenderer.

This all happens on the same frame:

  1. The gameobject was disabled, and gets enabled. (While the gameobject was disabled the MeshFilter is set to "None").
  2. An animation is played on the SkeletonAnimation that has a spine Event keyed on frame 0, which is used to activate the Ghosting.
  3. A null-pointer exception is thrown in SkeletonGhostRenderer.cs in Initialize() because the meshFilter.sharedMesh is null.

My workaround (and maybe permanent solution?) was just to add a null check for meshFilter.sharedMesh in Update() on SkeletonGhostPartsRenderer.

Spine version.txt says package version spine-unity-4.0-2021-12-21.unitypackage

@HaraldCsaszar HaraldCsaszar self-assigned this May 4, 2022
@HaraldCsaszar
Copy link
Collaborator

Unfortunately there is no file named SkeletonGhostPartsRenderer.cs and no class SkeletonGhostPartsRenderer in the spine-unity runtime. Did you mean another file/class?

@Jamez0r
Copy link
Author

Jamez0r commented May 4, 2022

Hmm that is strange... There is the possibility that I created it myself (based on SkeletonGhostRenderer?). Unfortunately the file was created before we switched to our current VCS (around 2 years ago), so I can't easily see whether I created it myself or not. But if its not in the runtime, then I suppose I did! I'll upload it just in case, but sounds like it might have been a false alarm. Sorry!
SkeletonGhostPartsRenderer.cs.txt

@HaraldCsaszar
Copy link
Collaborator

No need to apologize!

Unfortunately I still fail to find such a file/component. What also leads me to believe we've never provided such a component is this thread (7 months ago):
http://esotericsoftware.com/forum/Using-Ghost-renderer-along-with-Separator-16380
So my guess is that you have indeed written this class yourself. Your fix of adding a null check seems very reasonable, so please feel free to add this to your code ;).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants