Unity 2D Raycast Collision Detection

Hello everybody! I am currently trying to make a 2d space RTS game, which implies that the player has to be able to click on the unit, click anywhere on the game field, and the unit should be able to travel there. I am stuck on the point selection part. I thought about using a tile system for that, but, for some reason, raycast does not work for me, and the OnMouseOver would not work, because the script has to be on the object that is getting OnMouseOver-ed, data transmission requires public variables, and you cannot have multiple public variables with the same name, which makes multiple units impossible. Therefore, I am now stuck. I have no ideas on how to make this work. Please help. Thank you.

A simple example pulled strait from the docs.

void Update() 
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 100)) 
            Debug.DrawLine(ray.origin, hit.point);