Download

Struct set get attributes

It would be much easier if i could use structs as we usually use it. Meaning when we have a struct on visual script i need to split the struct to attributes so i can get the actual values i need. Which is not so helpful. For example a simple scenario to see the problem is… foreach an array of struct… check a value from the item i get from the foreach (i had to split attributes) then i needed to use the struct item in a function… i dont have that option after i split the item on its attributes… am guessing i need to store it somewhere… which is a little slapy… or use a get item with index i have from foreach loop… which again i dont like so much since no need to find the object again, since i already have it…

If i could just have the option

Struct Test {int a;}

and i could use something like

Test x;

x.a = 5;

set get actually… should be much easier… since u can do that on structs too its public variables. am guessing its not so hard to do

Thanks and keep up the good work :wink:

You can just drag out a second wire from the struct pin on the foreach node, to pass to your function.

True but i dont get 2 items stored of the same item in that way? since its a second variable.

I already do that in that way you proposed but i dont like it. I would never do that on code and it feels weird that i dont have set get access on the variables with a wire. I have a struct with like 10 attributes (and growing) and i have to split it so i can just use one or two for a simple compare. Anyway its just a suggestions :wink:

Thanks for the reply :wink: