From 067e36e94f62e62d38499bcee7b908e2cb28174d Mon Sep 17 00:00:00 2001 From: Dominik Morse Date: Sat, 31 Aug 2024 15:55:01 +0200 Subject: [PATCH] Updated initialization --- .../ActorInteractableComponentBase.cpp | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Source/ActorInteractionPlugin/Private/Components/Interactable/ActorInteractableComponentBase.cpp b/Source/ActorInteractionPlugin/Private/Components/Interactable/ActorInteractableComponentBase.cpp index 9848caa..ded77eb 100644 --- a/Source/ActorInteractionPlugin/Private/Components/Interactable/ActorInteractableComponentBase.cpp +++ b/Source/ActorInteractionPlugin/Private/Components/Interactable/ActorInteractableComponentBase.cpp @@ -66,17 +66,19 @@ UActorInteractableComponentBase::UActorInteractableComponentBase() : bVisualizeComponent = true; #endif -#if !UE_GAME -#if WITH_EDITOR - if (GIsEditor && !GIsPlayInEditorWorld && !bInteractableInitialized) +#if WITH_EDITOR && !UE_GAME + + if (!bInteractableInitialized) { - LOG_INFO(TEXT("[%s] Setting Default Values from Constructor"), *GetName()) - SetDefaultValues(); + if (GetOwner() == nullptr) + { + SetDefaultValues(); + } + + bInteractableInitialized = true; } -#endif #endif - bInteractableInitialized = true; } void UActorInteractableComponentBase::BeginPlay() @@ -1331,10 +1333,6 @@ void UActorInteractableComponentBase::InteractorLost_Implementation(const TScrip switch (InteractableState) { case EInteractableStateV2::EIS_Cooldown: - if (Execute_GetInteractor(this).GetObject() == nullptr) - { - Execute_SetState(this, DefaultInteractableState); - } break; case EInteractableStateV2::EIS_Asleep: case EInteractableStateV2::EIS_Suppressed: