Quellcode durchsuchen

[ue] Closes #2537, null renderer object if UTrackEntry is destroyed.

Mario Zechner vor 1 Jahr
Ursprung
Commit
1534558e38

+ 7 - 0
spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonAnimationComponent.cpp

@@ -82,6 +82,13 @@ void USpineSkeletonAnimationComponent::BeginPlay() {
 	trackEntries.Empty();
 	trackEntries.Empty();
 }
 }
 
 
+void UTrackEntry::BeginDestroy() {
+	if (entry) {
+		entry->setRendererObject(nullptr);
+	}
+	Super::BeginDestroy();
+}
+
 void USpineSkeletonAnimationComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) {
 void USpineSkeletonAnimationComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) {
 	Super::Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
 	Super::Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
 
 

+ 2 - 0
spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineSkeletonAnimationComponent.h

@@ -219,6 +219,8 @@ public:
 	UPROPERTY(BlueprintAssignable, Category = "Components|Spine|TrackEntry")
 	UPROPERTY(BlueprintAssignable, Category = "Components|Spine|TrackEntry")
 	FSpineAnimationDisposeDelegate AnimationDispose;
 	FSpineAnimationDisposeDelegate AnimationDispose;
 
 
+	virtual void BeginDestroy() override;
+
 protected:
 protected:
 	spine::TrackEntry *entry = nullptr;
 	spine::TrackEntry *entry = nullptr;
 };
 };