how would I select an object in play mode

how would I select an object in play mode for example when you play the game and you click on an object it would set a selectedObject variable ti the object you clicked on?

http://answers.unity3d.com/questions/173554/detect-the-game-object-was-clicked.html

http://answers.unity3d.com/questions/34795/how-to-perform-a-mouse-click-on-game-object.html

http://answers.unity3d.com/questions/23711/destroy-object-on-mouse-click.html

http://answers.unity3d.com/questions/10796/detecting-when-a-game-object-is-clicked-when-the-m.html

The above are the similar posts i have found across the forum. Basically you need a collider to be on the object, then you can use either raycast or OnMouseDown or OnMouseUp monobehaviour functions to set the selected object variable to the clicked one. Raycast seems good for you approach, since you need not call any other script’s function. I am answering thinking that it is a perspective came and the object is of any shape.
In orthographic camera it is much simpler because you dont need any collider you can calculate the area it occupies in the viewport using WorldToViewport function and mesh.bounds or scale(if the object is rectangular or square.). you have to convert the scale or bound to viewport point as well using the same function.

I hope this is what you were looking for. Btw the question is not clear, please try to post a some more details.