Okay got it! So the weird thing is I'm triggering this all off of an event to synchronize with the card flip... Do you have any ideas as to how I can reorganize that accordingly?
Edit:
I was able to fix it like this:
cardDisplay->getAnimationState()->setListener([cardWeak = std::weak_ptr(cardDisplay), skeleton = cardDisplay->getSkeleton()](spine::AnimationState* state, spine::EventType type, spine::TrackEntry* entry, spine::Event* event)
{
if (type == spine::EventType::EventType_Event
&& event
&& "flip_down" == event->getData().getName())
{
auto slot = skeleton->findSlot("cardback");
auto newAttachment = (spine::MeshAttachment*)skeleton->getAttachment("cardback", "cardback");
//custom function for calling functions between game loops.
ThreadManager::queueOnMainThread([cardWeak, slot, newAttachment]()
{
if (cardWeak.lock())
{
slot->setAttachment(newAttachment);
}
});
}
});
bit dirty, but it works!