diff --git a/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonAnimationComponent.cpp b/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonAnimationComponent.cpp index 1c800a871..ee868939a 100644 --- a/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonAnimationComponent.cpp +++ b/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonAnimationComponent.cpp @@ -35,6 +35,7 @@ using namespace spine; void UTrackEntry::SetTrackEntry(TrackEntry *trackEntry) { + if (entry) entry->setRendererObject(nullptr); this->entry = trackEntry; if (entry) entry->setRendererObject((void *) this); } @@ -80,6 +81,11 @@ USpineSkeletonAnimationComponent::USpineSkeletonAnimationComponent() { void USpineSkeletonAnimationComponent::BeginPlay() { Super::BeginPlay(); + for (UTrackEntry* entry : trackEntries) { + if (entry && entry->GetTrackEntry()) { + entry->GetTrackEntry()->setRendererObject(nullptr); + } + } trackEntries.Empty(); } diff --git a/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineWidget.cpp b/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineWidget.cpp index 9739fbd06..b1c21369b 100644 --- a/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineWidget.cpp +++ b/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineWidget.cpp @@ -108,6 +108,11 @@ void USpineWidget::SynchronizeProperties() { } else { slateWidget->SetData(nullptr); } + for (UTrackEntry* entry : trackEntries) { + if (entry && entry->GetTrackEntry()) { + entry->GetTrackEntry()->setRendererObject(nullptr); + } + } trackEntries.Empty(); } }