Move Object on Iphone

I try to change this code for project on Ipad, but i don’t work …

someone can help me?

thanks

using UnityEngine;
using System.Collections;

public class Fonction_Mesure : MonoBehaviour 
{
	public Vector3 screenSpace;
    public Vector3 offset;

    //Declaration des spheres
    public GameObject Sphere1 ;
    public GameObject Sphere2 ;


	
    void  OnMouseDown (){
       //translate the cubes position from the world to Screen Point
       screenSpace = Camera.main.WorldToScreenPoint(transform.localPosition);
       
       //calculate any difference between the cubes world position and the mouses Screen position converted to a world point
       offset = transform.localPosition - Camera.main.ScreenToWorldPoint( new Vector2(Input.mousePosition.x,Input.mousePosition.y));
      
    }

    /*
    OnMouseDrag is called when the user has clicked on a GUIElement or Collider and is still holding down the mouse.
    OnMouseDrag is called every frame while the mouse is down.
    */

    void  OnMouseDrag (){

       //keep track of the mouse position
       Vector2 curScreenSpace = new Vector2(Input.mousePosition.x,Input.mousePosition.y);     
          

       //convert the screen mouse position to world point and adjust with offset
       Vector3 curPosition= Camera.main.ScreenToWorldPoint(curScreenSpace) + offset;

       //update the position of the object in the world
       transform.localPosition = curPosition;
         
    }


}

Your event function can’t work on iOS. it’s only on PC.
You should look this link (Mobile Input)

The Event Function OnMouseDown(),OnMouseDrag()

My experience it’s work when test with unity remote but can’t work on device.

OnMouseDrag() and OnMouseDown() have no effect on iPhone.

However, replicating their functionality is extremely simple. Just rename the OnMouseDrag() function to something like “MyMouseDrag()”, and on the Update() of your script, call it.

Then, on the “MyMouseDrag()” function you have to check if the mouse button is being held down (Input.GetMouseButton(0)), and store a flag (a variable named something link “mouseDown” of type bool, so store if it’s being held down. If it’s not being held down, just early out of the function (i.e.: return).

Insite the “MyMouseDrag()” function you can use Input.mousePosition the same way you would use it on the original “OnMouseDrag()”.

If you need to implement “OnMouseUp”, do the same (create another function and call it from your Update()) and check the inverse: in this function, if the mouse button is NOT being held down AND the mouseDown flag is true, then it means it’s a mouse up. Just reset the mouseDown flag to false, and do what you need to do on mouse up into that function.

The good thing of doing this this way is that it will work both on the Unity Editor (and on a PC standalone) and on an iPhone/iPad.

I hope this helps. Sorry I don’t add more code explanation, but I’m in a bit of a hurry.

I thought only Input worked for iPHone Jehos?