Can changes be made inside blueprint structures?

Is it possible to actually change information inside of a structs?
Here I am attempting to change the ‘life points’ variable within a struct but in doing so I only seem to be able to change it within a local variable.

As evident by printing the variable in another blueprint where it appears to be retaining its default values initially made in the editor.
image

Any information on this is appreciated, thank you.

Yes, you can change values of structs. It’s just data.

Not sure I get the evidence. You’re updating one struct but printing another… Each actor instance has its own data. Changing a struct belonging to one actor will not make it propagate to another instance.

I only seem to be able to change it within a local variable.

Why are you calling it a local variable, it’s not local. We’re in the main graph.

Sorry I musn’t have been clear, or maybe I’m doing something silly, but both variable are the using the same struct. Each screenshot is from a different blueprint. I was intending to change the information in the structure so that the other blueprints could fetch it from the struct too. It seems local in that if I change it in the first bp then it stays consistantly changed there but not elsewhere when I try to get it.
I only named them different because they are in different bps, they are both using the same struct.
image

It does not matter. They are different variables. They do not know about one another.

In order to Tick Print the change you made, you’d need to access the instance of the actor that changed its own struct.


Perhaps think of the struct as of a simple string. If I add 3 actor instances, each with a piece of unique text:

If I now go to the Game Mode and create another string there, it will be just an empty string unless I punch in some text or grab one of the actosr and get its unique text. Structs are no different - they are collections of basic variables.

Variables are just containers data sits in.

It seems I have incorrectly conceptualised structs, I was thinking of the struct as though it were a definitive place to change information within as opposed to being just a variable

It’s just a fancy variable that is difficult to work with and makes the editor crash more than usual. Indispensable, though.

Were you expecting them to behave like they do in C++? You could declare a struct in a framework class and have other actors access it but BPs copy a lot of data, one needs to mindful of that.

1 Like

I see I see, thank you for straightening that out for me, and for the warning. I haven’t used C++ before no, but I’m flattered in some sense that the line of thinking would lead to that connection.

Also just to say, I see you all over the forums here whenever I look stuff up and you’re great help, keep up the great work.

1 Like

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