Only one can change color?

Hi everyone!

I have a little problem here. In the game I am creating at the moment I want the player to click on different cube, it’s a grid in fact.

The blocks are Grey
When he click on one it turns to Yellow
When he right click on one it turns to Brown

The problem is: I want only one Yellow and one Brown but the player may change is mind.

I thought of get all actors that make the grid and change all there material to grey, but it would remove the brown one if he wants to change the Yellow one.

Any one have Ideas of where I can start? Which nodes might be useful?

Thank you very much!

Like, Is there a way to select all mesh that have the “MBasic_floor” material?

Got it was pretty easy finally, just had to set a last click variable and remove it for each color

(remove material from last click yellow) (Set material for current click yellow) (Set Last Click yellow)