Increment / decrement a counter based on states

Oct 30, 2023

Hello, I have an object with a hover / selected state.

I want to increment a variable when I click on this object to put it in the selected state, and to decrement it when I put the object in the normal state.

My triggers so far :

- +1 when I click, if the state = selected

- -1 when I click, if the state = normal

For it to increment, it seems that I have to use the target state of the click, but the decrementation does not work at all.

1 Reply
Judy Nollet

When an object has multiple states, I suggest you avoid triggers with conditions that check if the object = Normal, because all of the states have a bit of Normal in them. 

The easiest fix in this case is to use an "Else" statement in the trigger. For example: 

This is demonstrated in the attached file.

Another option would be to use " Selected" (instead of "= Normal").