So I have a clicker game, 4 resources. At the top of the page are 4 tabs, you tap each tab to switch to the resource. (each resource page has its own layout). Each layout has a white circle sprite that you click to earn the resource.
So I have a variable, 'IsTappable' and when it's true the circle is white and you can click it to earn the resource which sets the boolean to false. This runs a function which gives x number of resources and runs a cooldown of x seconds, using a global cooldown variable for each resource and sets 'IsTappable' back to true. Basically, when the boolean is false the circle is grey.
However, if I switch tabs during cooldown of the resource when I switch back to said resource layout the boolean is stuck false and the circle is grey.
Any help would be greatly appreciated. :)
Thanks, Max