How do I deselect an object when another is selected?

I have 10 points and I want it so when I click the first point it is selected and when i click the second points it deselects the first point and selects the second points. The game is 2d. How can I do it ?

store the clicked object in a variable and whenever you click on the new one, you just assign it to the new object

1 Like

It depends on what “selected” means, or what happens visually/internally when selected or unselected. You may need to deselect everything anytime a new point is selected, then select (whatever that implies) the new one. For example, changing the color of the object when selected or not. All the points should be in an array.