Mouse follow performance in iPhone

Hi guys!

I want to make a game object to follow my mouse pointer and it’s working perfectly in desktop however in iPhone the object movement is delayed. I assume it’s because of the processing power and probably my method is not suitable for iPhone, I’m not really sure. So far, here is the script for mouse follow.

private var depth : float;
private var count : int;
private var touch : Touch;
private var wantedPos : Vector3;

function Awake(){
	this.renderer.enabled = false;
	depth = 10;
}

InvokeRepeating("FollowMouse", 0, 0.1);

function FollowMouse(){
	count = Input.touchCount;
	touch = Input.GetTouch(0);
	if(touch.phase == TouchPhase.Moved){
		wantedPos = Camera.main.ScreenToWorldPoint(touch.position);
		transform.position = wantedPos;
	}
}

If in iPhone, the game object is a bit late so it’s following behind the touch position while in desktop, the game object can perfectly follow the mouse location. Thanks in advance! =)

EDIT: Changed from using mouse input to touch input.

Why is “this.renderer.enabled = false” in Update, rather than Awake?
Also, never declare variables in Update. Declare them at the start of the script and include types.
If it’s still too slow, replace Update with an InvokeRepeating that goes 15 times a second or so.

You shouldn’t be using anything “mouse” related on the iPhone anyway. It will probably stop working in an upcoming
version of iOS or Unity.

http://unity3d.com/support/documentation/ScriptReference/Input.GetTouch.html