I would guess you are changing your currently selected tree somehow.
First, thank you for taking the time to reply. I appreciate it.
I have the code set so that when I left click a tree, the Tree_ID global variable is set to the Tree_sprite.UID Then when I left click the up arrow, the Tree_ID is used to add 10 leaves. Maybe I'm not selecting the tree correctly?
Open your game in Debug mode and pay close attention to where your code breaks down.
- Can you successfully click a tree and store the Tree's UID in Tree_ID (bad naming convention going from UID to ID but I didn't notice any mess-ups from this in the code you showed).
Absolutely fair. As late in the night as it was and with the frustration with the other project, I went with the dirty to try and figure out why I was struggling. But, fair point and one that I will take better caution wit.
Does the UID match the tree it should match? It does. The text box is updated every second and the UID matches as I click back and forth between the trees.
Can you click on the upgrade button and keep that same UID saved?
When you click the upgrade button does a different tree gain leaves? Does Tot_leaves increase? When I click tree with UID 2, the leaves instance variable will increase however when I click on UID 3, it does not. However the Tot_leaves does increase regardless of which tree I select, which it shouldn't if UID 3 is "broken".
These will all help you realize where your code is breaking down
I'll try some other things but you don't see anything in the coding that would prevent it from running as expected? Or do you have a different approach that you would suggest?