I have a component that inherits from UBoxComponent and on the onComponentCreated Event y create an Arrow Component
Socket.pushableShoket = NewObject<UArrowComponent>(owner, TEXT("PushableSocket1"));
owner->FinishAndRegisterComponent(Socket.pushableShoket);
Socket.pushableShoket->SetWorldLocation(GetComponentLocation() + Socket.PositionOffset);
Socket.pushableShoket->SetWorldRotation(FRotator::ZeroRotator);
Socket.pushableShoket->AttachToComponent(this, FAttachmentTransformRules::KeepRelativeTransform);
Socket is a structure:
USTRUCT(BlueprintType)
struct FGrabSocket
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
UArrowComponent *pushableShoket;
UPROPERTY(EditAnywhere)
FVector PositionOffset;
};
declared as
UPROPERTY(EditAnywhere)
FGrabSocket Socket;
since i cant modify the transform values of the arrow component in the instance placed in the world with the editor
i decided to have an FVector insde the structure representing the offset and then applaying that transform on property change
void UPushableComponent::PostEditChangeProperty(FPropertyChangedEvent & PropertyChangedEvent)
{
Socket.pushableShoket->SetWorldLocation(GetComponentLocation() + Socket.PositionOffset);
UpdateComponentToWorld();
Super::PostEditChangeProperty(PropertyChangedEvent);
}
Problem: whenever I change a property the event triggers but then the creation of the actor is triggered all over again and resets all my properties.
How can i preserve the changes so that i can change the location of the arrow component in the editor?