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 Answer 1

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, 2020 at 11:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .