0
\$\begingroup\$

In my BluePrint Tick function for my character, I have a FVector that always changes, and in my C++ component, I want to get this changing FVector and use it in my C++ Tick function, is that possible to do?

\$\endgroup\$
1
\$\begingroup\$

To set this in C++, you need to create a UPROPERTY in your C++ code then write a function to set this property.

In your C++ header file:

UPROPERTY(BlueprintReadWrite, Category = "FVectors")
FVector MyCPPVector;

UFUNCTION(BlueprintCallable, Category = "FVectors")
void SetFVector(FVector VectorIn);

And in your cpp file

void SetFVector(FVector VectorIn)
{
    MyCPPVector = VectorIn;
};

Now after you've set the FVector in your Blueprint, call the SetFVector function and plug the BP FVector output into the input of the function.

\$\endgroup\$
1
  • \$\begingroup\$ This is the correct and most concise solution \$\endgroup\$ – Natalo77 Mar 30 '20 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.