Hello.
I was wondering how can I check what’s the name of the object i clicked. I almost finished my game and I want to add a new feature. When the user slicks on a place in the map, a new soldier gets created there. I was wondering how can i check on what the user clicked (i want to restrict user from creating a new soldier on a place with water.)
Specifically, the last example on that page shows how you can use the current mouse position to cast a ray to see what you hit. The resulting RaycastHit object that’s returned can tell you what object you hit (hit.transform.gameObject.tag) Unity - Scripting API: RaycastHit