How to touch select 3D objects

New to Unity and Scripting… I would like a simple example of selecting a 3D object by touching the screen. I am either terrible at searching or there aren’t many simple examples out there (probably the former).

I am guessing that you need to make a raycast to detect the object but I’m not sure how to do this.

Once the object is selected I would like to drag it, but that’s a separate question.

Yes, that’s what raycasting is used for:

var ray : Ray = Camera.main.ScreenPointToRay(touch.position);
var hit : RaycastHit;
if (Physics.Raycast(ray, hit, 100)) {
    selectedObject = hit.transform;

Once you have remembered the object you can also it’s transforms position when it’s dragged.

If you don’t want to have all objects selectable, you will want to check the objects properties to see wether it’s selectable or use layer masks to limit the raycasting.

Make sure each object (or sub object) has some sort of Collider on it. Then you can implement an OnMouseDown handler in a script which you attach to that (those) object(s).