What's the best way to do a toggle button? The methods I've tried these past days doesn't seem to work and it's so annoying...
I want this:
· In the scene, there is a character.
· If the player touches the button > The sprite (state) of the button change, the actual character dissapear and appear another at the same position of the initial character.
· When the player touch the button again, it's the same process, but the other way around. So the button have two states and there are two characters to alternate.
· There are two classes of objects during the game. Character A can collect only object A and character B, only object B.
What's the best way to do this? I'm confused, because I don't understand why my methods have failed.
Also, another simple doubt:
I've set an action when the player touches any area of the screen, but I don't want to activate this action when an UI button is touched. I only want to activate the button action. How could do this correctly?
Thank you for your help!