Object varriables within a Group

I’ve been trying to simplify things by using Groups. it’s worked so far. but I have a game that uses Object Variables, - within - groups. and it’s almost perfect. you can see that on the left, it knows the variables are there, within the group, within the object. “x_force” and “y_force” are there. it knows they exist. yet on the right, when i call the function to “change the position” and i add “x_force” and “y_force” it no longer knows these variables exist. i see this as a glitch. has anyone else noticed this problem?

it has to get the object variable, within the group, because it needs to apply one behavior to different objects in the group. i want to apply a force to just one at a time.

1 Like

Make sure that each object in the group has the x_force and y_force variable, and make sure they are spelled correctly.

When you go to the object group variable editor do you see the variables there?


You should see the two variables listed here.

2 Likes

thank you for reply. yes the variables are already there. the first thing i did was check that. for now i created a temporary solution to individually apply the x and y force to each of the enemies instead of calling the group in that case. i noticed this seems to be happening because i am using global group and global enemies. and i have a lot of enemies, like 40 right now but it could go up to 200. it seems that it is getting confused by the “global enemies” that are not currently on the scene. so if i have 20 enemies on the scene but 20 that are not. it wants me to drag all 40 onto every scene. which is silly. so for now i have to use the round about solution and not call the group in that case.

it’s also possible this could be a case of, say out of all those 40 enemies, 1 of theme happens to have the same name as a variable somewhere. that could cause the problem. it doesn’t like that. it could be a case of that but i don’t think so.

I tried to replicate the error you have, and the only way I could do it was when one of the objects didn’t have the variable.

I’d suggest going through each enemy and confirming each one has that variable, same spelling and case. I know you wrote that you’ve already done this, but there will be one object you’ve missed.

thank you. since i have so many enemies it is possible that i missed one. I might have to check enemies that are not on the current scene but part of the global group.

Yes, unfortunately you will have to check all the objects. The group is of all the member objects, not just those member objects in the scene.

even if I don’t add the variables. GDevelop automatically creates them when I add the object to the group. I just confirmed it.

another thing with this, is that I am not able to call any variables. even other ones i’ve used before that i know work. but it only apples to specific commands. for most of the commands it works and the variables are found. it seems like a gdevelop glitch. you think if the variables weren’t there it would cause a problem with all commands.


it seems to have a problem with getting the variable when changing the position. it’s that format of Group. where it gets confused.