Download

Issues with changing variables within Structures

Hello everyone,
I got it resolved now, seems like I didn’t properly understand what Structures actually are, but I got that now ^^

old:
so recently I was trying to approach my character blueprint in a different way by moving a few variables into a Structure.
The idea behind that was that every other blueprint which needs to access the variables just have to get them from the Structure instead of having to cast to the player and then getting them, but as it seems this doesn’t work like I thought it would.
For example, here I want to change the player’s health, while it works within the blueprint, the variables don’t change for any other blueprints getting the values from the Structure. (This is just for testing, nothing which is used within the game btw.)

&stc=1

This is an example where I try to get the health from the struct within my UMG Hud, but the problem is it does not update.

&stc=1

So either the way Structures work is a different to my assumption that they act like global variables which can be changed by every blueprint which access them and update for all the same way or I am doing something wrong.

I would be glad if anyone could help me out here, or should I just stick with the variables within the character blueprint?

Greetz,
Dakraid

Maybe I didn’t understand u properly, but stucts don’t work like global variables or something. Its just a type of variable, that stores other variables inside it, similar to vector type or transform type. So, if u want to get access to characters variable u have to use one of communication methods (Cast, blueprint interfaces etc).

Now I get what I had wrong in mind, thank you. Casting within the blueprints to the player pawn and then getting the Structure works properly now ^^

Greetz,
Dakraid