Blueprint and C++

You can access blueprint variables but it’s very tedious and counterproductive

I would highly suggest making a c++ base class with the variable as a UPROPERTY and then deriving from that class.

Or alternatively you could have a getter and setter function that is a BlueprintImplementableEvent (it calls blueprints from c++)

example

UFUNCTION(BlueprintImplementableEvent,BlueprintCallable)
void SetVar(float passedVariable);

UFUNCTION(BlueprintImplementableEvent,BlueprintCallable)
float GetVar();

Then from within the blueprint derived from the function you could set a blueprint variable or retrieve it by implementing the functions (they will show up to be implemented in the functions section on the left side inside of the blueprint).

This way is less susceptible to breaking if you change the variable from within blueprints.

1 Like