How can I change a variable from c++ and take effect in Blueprint?

How can I change a variable from c++ and take effect in Blueprint?

I have created a function an a variable which both are visible in my blueprint but when I try to change the value from the script, the value in the script remains the same, how can I change that?
In the BP I had it as yellow line, just changing the value from C++ but didn’t work :frowning:

First image is my .h, then my .cpp and finally my BP


image

Better to use this:

In .h:

UFUNCTION(BlueprintImplementableEvent)
void TurnOffParticlesEvent(bool bOffBool);

void TurnOffParticles(bool bOffBool);

in .cpp:

void Aclase3::TurnOffParticles(bool bOffBool)
{
    TurnOffParticlesEvent(bOffBool);
}
1 Like

Anything that is a UPROPERTY should work well in C++ and Blueprint both.

Maybe your Event Turn Off Particles runs after the Event Begin Play has already run, and thus the variable isn’t actually checked?

1 Like

My logic wasn’t the right one, with @ackyshacky is working now, thanks both <3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.