Download

Changing a variable from another blueprint

What am I doing wrong? Why doesn’t the variable change?

What should be specified in the target?

1 Like

put a print after the false execution pin on the cast node.
put a print node in the class that holds the variable and connect it to tick, see if it changes

I moved the failed cast and it didn’t work.

Perhaps you could tell us what you’re trying to do. From the top.

I want to change the variable from the player’s blueprint from the door blueprint

why the outer object node?
why not get player char > cast to PC

It’s this, as above:

But in 99% of cases it’s not really what you need, it’s what you think you want. Why would the door need to know the player exists in the first place? Shouldn’t it be the player that communicates with the door?

I might be missing the point, of course.

In the caste per player’s persona, it is impossible to change the variable from the blueprint, it simply is not there. I need to learn how to do this, so that later in any object from other objects to change the variables as I need it.

I have already managed to access a variable from one blueprint in another, the only thing is not clear what to specify in the target

In the caste per player’s persona, it is impossible to change the variable from the blueprint, it simply is not there.

What do you mean? This does not add up.

These allow you to communicate in OOP manner within blueprints.

You said:

I want to change the variable from the player’s blueprint from the door blueprint

And that’s precisely what the snipped I suggested does.

I have already managed to access a variable from one blueprint in another, the only thing is not clear what to specify in the target

You can’t access a variable in another blueprint without a target as that blueprint is the target… If I needed to access the possessed player’s character from anywhere, I’d:

You need to cast to the correct type, of course.

Do note that this will work only for framework classes - like the Player Controller or the Game Mode. You can’t do it with a Door actor for example as there can be a 100 door actors in the level and you need to tell the editor which door is the target.

What you call the As Target in your image is somewhat confusing - what does this blueprint represent? You’re attempting to treat it as if it was the player.

is the variable exposed?

But why when I go from As third person character there is no variable I need?

It does not need to be. Perhaps you meant private? Variables aren’t private by default. Chances are it was flagged as private - worth checking.

What are you using as a character then - what’s the name of the class that you’re using?

“target” At the very beginning of the topic you can see

image

But that’s the name of the Animation Class, not the Character Class. Anyway, what are you trying to do again?

I want to change the variable from the player’s blueprint from the door blueprint

You don’t want to do that judging by where we’re getting with this. This is really confusing at this point. :expressionless:

Is the variable that you’re trying to access in the animation instance the character’s mesh is using?

This? Here’d you’d cast to target if that’s the animation.

Cast To ThirdPerson_AnimBP was pruned because its Exec pin is not connected, the connected value is not available and will instead be read as default

where can you see the class of the object?