Forum Discussion
MarineDEMAISON
2 years agoCommunity Member
Count how many objects are in selected state with an incremental variable
Hello, I have an object with a hover / selected state. I've used auto states to select / deselect when I click on an object.
I want to increment a variable when I click on this object to put it in...
WaltHamilton
12 months agoSuper Hero
Phil, of course, is correct. Incrementing and decrementing variables is always risky. It’s more reliable to count every time you need a change. Using a layer allows you to create one set of variables that will work for all your buttons. Everything else, do as Phil says.
I would change Nedim’s suggestion to do your changes when Button 1 is clicked, rather than relying on when the state changes to selected. Detecting state changes is not always reliable.