Clicking on objects

I am making a TD game and I need to be able to upgrade my turrets. Unfortunately I do not have the knowledge to do such a thing. Do note that I am NOT using a grid system. Any help is appropriated in advance. Thanks!

There’s OnMouseDown, or you can do a ray cast when you click the mouse button to do stuff with the object that the raycast hit. Both solutions require a collider on the object. These are two ways of doing it that I think are pretty easy and popular.

OnMouseDown (easy):

Raycasting on click (pretty easy, requires more code, gives finer control):

Do you want to know how to click an object and replace it with another one? If so, use OnMouseDown in the object script:

var nextObject: GameObject; // drag the replacement prefab here

function OnMouseDown(){
  // create the new object at the same position and rotation
  Instantiate(nextObject, transform.position, transform.rotation);
  // destroy the older one
  Destroy(gameObject);
}