DunkelBlume

Hi!

I'm running into a Null Reference when I try to get the attachments of a slot from a skeleton when running into a mobile device. Do you guys know if I need to initialize (or wait for) something before attempting to find the slot and its attachment?
My skeleton has several slots and I use this line to get the attachment
Attachment currentSlotOff = MyAsset.Skeleton.FindSlot(SlotName + "Off").Attachment;
Attachment currentSlotOn = MyAsset.Skeleton.FindSlot(SlotName + "On").Attachment;
I'm using C# in unity and a SkeletonGraphic.

Steps
  • I have the SkeletonGraphic already on the screen.
  • When initializingthe asset that uses this skeleton, I try to get the slot and the attachement
  • I get a null reference, but only on the mobile build never on Unity's Editor


Thank you for your help!
Benutzeravatar
DunkelBlume
  • Beiträge: 6

Harald

From where are you calling the above line of code?
Is your SkeletonGraphic GameObject perhaps instantiated via code or loaded dynamically in another way?
Benutzeravatar
Harald

Harri
  • Beiträge: 1969

DunkelBlume

Hi Herald, nope, the skeleton is already in the scene, with an idle animation (this doesn't change) and Starting loop option ticked

---

We solved it!!! :greatsuccess:
So... we were trying to use the slot before Spine finished the initilialization,
we used the
SkeletonGraphic.Initialize(false);
to wait until this was done and then make use of them. :D
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Benutzeravatar
DunkelBlume
  • Beiträge: 6

Harald

Glad you figured it out! Thanks for letting us know.
Benutzeravatar
Harald

Harri
  • Beiträge: 1969


Zurück zu Runtimes