-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Last component generated by a loop is changing the value of all objects in the array #5773
Comments
It looks like you're on the right track, but the way you're handling the ID disambiguation isn't quite right. The problem is your use of The easiest solution here would be to use the If you haven't read the FAQ entry on the ID stack you definitely should. The ID stack tool mentioned there is helpful for understanding what's happening in these situations. |
Thanks for the suggestion, I'm just starting with Dear ImGui and I didn't knew how useful the FAQ was, I'm definitely going to digg deeper into that. Now regarding use the actual object on PushID, the result was that now the first component isn't with huge random number anymore, it's fixed with negative zeroes, and I'm filling the id's of each object manually so I thought that it would be enough. After doing this change the behaviour changed a little, the last component still changing all the object's values but when I tried to use the first one the application crashed what wasn't happening before. Note: I already fixed the same id's (Translation y) |
I've just realize I said a wrong statement when I said "last component created is changing the values of the remaining components", the correct is "the last component created is changing the values of all the objects in the array, the other components get stuck at negative zeroes or with huge random values" |
The PushID/PopID is absolutely unnecessary here as you are Begin-ing into a new window anyway. |
As the mistake is here:
ID conflict. Closing. |
This is already fixed as I've mentioned on the original post, but you're right it's some other problem on my code. Thanks anyway. |
Well |
Well we cannot really help without additional info. If you find/understand your issue good to post details here. |
Sure, I'm still investigating it and once I find out I'll post here but it's definitely not related to Imgui. I put it to print the positions and the problem was there, now this is fixed but both objects are still moving together even thought the translations values are different. Anyway I think it might keep as closed, once it's not related to ImGui. Thank you very much anyway! |
hey hi, I've found two issues with my code.
Now everything is working perfectly. Thank you very much for all the help with ImGui even though all the issues were on me haha. Awesome project btw. |
Also #74, #96, #480, #501, #647, #654, #719, #843, #894, #1057, #1173, #1390, #1414, #1556, #1768, #2041, #2116, #2330, #2475, #2562, #2667, #2807, #2885, #3102, #3375, #3526, #3964, #4008, #4070, #4158, #4172, #4199, #4375, #4395, #4471, #4548, #4612, #4631, #4657, #4796, #5210, #5303, #5360, #5393, #5533, #5692, #5707, #5729, #5773, #5787, #5884, #6046, #6093, #6186, #6223, #6364, #6387, #6567, #6692, #6724, #6939, #6984, #7246, #7270, #7375, #7421, #7434, #7472, #7581, #7724, #7926, #7937 and probably more.. Tagging to increase visibility!
I'm trying to create a UI component for every object that I have on an array so I could change the values of them, and I'm doing this by a loop:
Just a small example but the structure is pretty much the same. With only one component everything works fine, however with multiple objects the last component created is changing the values of the other objects in the array and the remaining created components get stuck on negative zeroes or with huge random numbers.
Am I missinterpreting something or is there some other way to do it? I've tried many solutions to this but any of them seems to work.
Any help or pointer to my stupidity would be appreciated.
Thanks.
The text was updated successfully, but these errors were encountered: