Group Variables - Structures

I’m having trouble with the new Group Variables picking up Structure variables. Not sure if this is a bug, or something I’m doing wrong. Here’s the setup…

I have two sprite objects (SpriteA, SpriteB). SpriteA and SpriteB both have a standard number variable (ID) and a Structure variable (Data). Both Data Structures inculde the name/value pairs (ex. posX, posY), but SpriteB has additional variables (skillType=text, Inputs=structure, wood=child of Inputs, stone=child of Input),etc.

When I view these variables in the Group Variables, I only see: ID, {Data}, but Data has no children. I think Data should show the common children (posX, posY), but not the variables unique to each sprite (SpriteB.skillType, SpriteB.Inputs.wood, SpriteB.Inputs.Stone). Why aren’t the common children (Data.posX and Data.posY) showing up?

I just tried it with 2 objects and it worked for me. I’m using the PC version 5.4.207

image

Thanks for your reply!

When I open the Group Variables tab, I see the structure variable “Data” with “mixed values” as children. There is no ability to drop down a view of the common children in Data. Again, SpriteA has some different Data children than SpriteB, but also some in common. I would like to see the children they have in common listed in the Group Variables tab within the Data structure, but do not expect to see the children that are different. I can’t tell if you are building your objects the same way (with different structure children) from your example. Maybe this isn’t possible with structure variables once you alter the children to be somewhat different, but that’s what I’m curious about.

Ah, I see what you mean now. It only shows children when all of the children match. I added a structure with the same children and it shows them but after adding just 1 different child, the previously showing common children names disappeared from the group variable list. The same thing happens with arrays. It seems to be an all or nothing approach.

What’s even worse than not showing is if you try to add a group child to a structure that’s not showing the children it deletes all of the previous children of the structure whether they matched or not. It seems to overwrite it. This is when added through the group variable list.

Yes, I had something similar happen. When I tried to work with the Group variables and alter things there, it zapped many of the variables I didn’t want altered in the individual objects. I had to rebuild each. I’m now very leary about working with the Group variables since I use a lot of object structure and array variables.

My approach is to build the structure variables in each object, then create a Group of similar objects as required. But if I need to add a child to a structure variable, I do so in each object (copy and pasting as necessary) rather than attempting to alter the Group variables themselves. This of course seems to defeat the purpose of Group variables, but maybe they are not well suited to structures and arrays.

That seems like a plan. Either use separate groups or make sure each object has identical children. Structures and arrays can get pretty complex depending on how many levels you have. Unless, each object has the same structure, entire child structures could fail to be displayed. Not just the children but possibly any children of the children.

I resurrect this topic, but it seems for me still that there is still a bug here:

The variable declared in the group are always deleted after a while, because the object prefab have set different values for these variables.

My concrete example: I create a variable list of structure “scoring_list” in my group, with 2 child, and in each child the 3 same variables: “method” “type” (both str) and “value” (number). The value of the variable is by default “” or 0.

When I edit the variable values (and not the variable type or naming, which is why I see this as a problem) of any of the structure variable for the global objects prefabs belonging to the group, then the group behave weird, and display “mixed values” for the list, with no children (meaning both structure and structure children disappear for the group variable window). If try to re-type in the group window exactly the same structure childrens, it is visible for few seconds, and is again replaced by “mixed variables” as before. If I look in the global object prefabs, I see my field properly being presents, however further group edits of this list are not visible.

For me it is not clear what gdevelop expect me to do.

In a very minimal bugfix, it should be written something like “mixed variables or values in group objects, delete all the group objects variables and values in order to restore from the group object”, or describe whatever is blocking.

A lower bugfix would be to prevent modifying variables and values from the object belonging to group object is this lead to instability at group level and mark them with different color in the editor, to understand it have an impact.

A good fix would be that, when there are mixed variables or variable values, the group object variable windows offer a button to force to apply to all group object items, and that there should be a clear separation beetween mixed variable and mixed variable value, only a mixed variable type or naming should be blocking.