how does set member in struct work

I find two ways to set a structure in blueprint, set structure by ref and set member in struct. I use set member in struct to update struct in my project. In my view, set member in struct is more convinent for it can set and show single member. As I dig in, I ask the AI assistant for more imformation, and it said ‘Set Members in Struct do NOT change the original struct’, and I must set it back to update it, which doesn’t match the result when I use it.

So I make a small test:

The result shows the struct do updated without set back.

Then I do as the AI assistant suggested, and delay, use another event, and use function and local variable, they all updated without set back

So what do I miss? Or I am just doing ok?

1 Like

The whole point of ‘set members in struct’ is to update part of a struct

As is often the case, AI has it wrong, and is revealing itself once again as a distillation of all the garbage on the internet… :slight_smile:

Using a delay being a good summary of what is wrong. A delay is basically NEVER a good idea ( unless you actually do just need to wait ), but examples are full of it.

4 Likes

This could actually happen, but it depends on how you are getting the struct in first place, it doesn’t work when you use “Get” from an array, because by default it returns a copy of the value, not a reference (you can change this by right clicking it) and sometimes it also doesn’t work in loops or with widget structs, when you want to change the style for example: the get style function is probably returning a copy of the style and not a reference, so you have to set it back

1 Like

this. don’t forget the small text at the bottom that says “ai makes mistakes”.