real time strategy (rts) single unit selection help

I am trying to make a / an RTS game, but I’m struggling to get the selection mechanic to work. not even multiple unit selection, just single unit selection. I already have semi functional scripts, just need a way to send a raycast from the mouse, detect if an object is there, and set it’s “IsSelected” to true. Anyone willing to help?

test this code, there are other overloaded raycast methods that can give you a hit object with which you can compare tag just for making sure you hitted the right object - unit, thats just up to you :slight_smile:

 void Update()
 {
      Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
      if (Physics.Raycast(ray, 100))
         isSelected = true;
 }