I'm not sure if I totaly understand what is your goal, but if you just want to detect if user clicked game object on mobile you can use Input.touches
void Update()
{
for (int i = 0; i < Input.touchCount; i++)
{
if (Input.GetTouch(i).phase == TouchPhase.Began)
{
Vector3 p = Camera.main.ScreenToWorldPoint(Input.GetTouch(i).position);
int layerMask = 1 << objectLayer;
Ray ray = new Ray(p, Vector3.forward * distance);
RaycastHit2D hit = Physics2D.GetRayIntersection(ray, distance, layerMask);
if (hit.collider != null)
{
YourObject obj = hit.collider.GetComponent<YourObject>();
if (obj != null)
{
// player clicked on the object
}
}
}
}
}
I did not test that code but it should roughly work for 2D, objectLayer
is the index of the layer of your object and distance
is how far should the Raycast go.
I have never done somthing like this for 3D but I guess it would be simillar.