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?
1 Answer
\$\begingroup\$
\$\endgroup\$
1
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.
-
\$\begingroup\$ This is the correct and most concise solution \$\endgroup\$– Natalo77Commented Mar 30, 2020 at 11:04