diff --git a/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonAnimationComponent.cpp b/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonAnimationComponent.cpp index 428c5b9c5..c8b22b69f 100644 --- a/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonAnimationComponent.cpp +++ b/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonAnimationComponent.cpp @@ -82,6 +82,13 @@ void USpineSkeletonAnimationComponent::BeginPlay() { trackEntries.Empty(); } +void UTrackEntry::BeginDestroy() { + if (entry) { + entry->setRendererObject(nullptr); + } + Super::BeginDestroy(); +} + void USpineSkeletonAnimationComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) { Super::Super::TickComponent(DeltaTime, TickType, ThisTickFunction); diff --git a/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineSkeletonAnimationComponent.h b/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineSkeletonAnimationComponent.h index be4af1461..6975b65c5 100644 --- a/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineSkeletonAnimationComponent.h +++ b/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineSkeletonAnimationComponent.h @@ -219,6 +219,8 @@ public: UPROPERTY(BlueprintAssignable, Category = "Components|Spine|TrackEntry") FSpineAnimationDisposeDelegate AnimationDispose; + virtual void BeginDestroy() override; + protected: spine::TrackEntry *entry = nullptr; };