diff --git a/Source/RWTHVRToolkit/Private/Interaction/Interactables/ActionBehaviour.cpp b/Source/RWTHVRToolkit/Private/Interaction/Interactables/ActionBehaviour.cpp index ff1d027208025476ce073a15bd224ca5c9ccb9f0..f6e2eae42674ea65da59b7e2082d50b81dcf34bb 100644 --- a/Source/RWTHVRToolkit/Private/Interaction/Interactables/ActionBehaviour.cpp +++ b/Source/RWTHVRToolkit/Private/Interaction/Interactables/ActionBehaviour.cpp @@ -17,3 +17,9 @@ void UActionBehaviour::BeginPlay() OnActionEventEvent.AddDynamic(this, &UActionBehaviour::OnActionEvent); } +void UActionBehaviour::EndPlay(const EEndPlayReason::Type EndPlayReason) +{ + OnActionEventEvent.RemoveDynamic(this, &UActionBehaviour::OnActionEvent); + + Super::EndPlay(EndPlayReason); +} diff --git a/Source/RWTHVRToolkit/Private/Interaction/Interactables/GrabBehavior.cpp b/Source/RWTHVRToolkit/Private/Interaction/Interactables/GrabBehavior.cpp index c62cfb45d3fa787ad981b1bb6a0917e4f36758e5..a9fc2c3d4a8f9723656e2fc0f393fd9e1b440927 100644 --- a/Source/RWTHVRToolkit/Private/Interaction/Interactables/GrabBehavior.cpp +++ b/Source/RWTHVRToolkit/Private/Interaction/Interactables/GrabBehavior.cpp @@ -18,9 +18,8 @@ UGrabBehavior::UGrabBehavior() void UGrabBehavior::BeginPlay() { - Super::BeginPlay(); - OnActionReplicationStartedOriginatorEvent.AddDynamic(this, &UGrabBehavior::ReplicationOriginaterClientCallback); + Super::BeginPlay(); } void UGrabBehavior::EndPlay(const EEndPlayReason::Type EndPlayReason) diff --git a/Source/RWTHVRToolkit/Public/Interaction/Interactables/ActionBehaviour.h b/Source/RWTHVRToolkit/Public/Interaction/Interactables/ActionBehaviour.h index bf3afea3a1246994a0bcbfb1d96317083e2770e3..2a65a20f8b86fbb5378f5756e20e9c760255a4ec 100644 --- a/Source/RWTHVRToolkit/Public/Interaction/Interactables/ActionBehaviour.h +++ b/Source/RWTHVRToolkit/Public/Interaction/Interactables/ActionBehaviour.h @@ -42,4 +42,5 @@ protected: const FInputActionValue& Value); virtual void BeginPlay() override; + virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; };