Mouse Follow Problem

Hello, I’m using Unity Personal to develop a simple 2D game.

I made a Scene with just an Othographic Camera and one object with a single script to illustrate the problem:

void Update () {
    Vector3 target = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    target.z = 0;
    transform.position = target;

This script will make the object follow the mouse.

The “target.z = 0” part is because the camera is looking up the z axis and I want the object to stay on the z=0 plane.

Problem: moving the mouse fast enough results in an offset between it and the object.

My game is touch and I don’t like the collider area getting away from the finger.

What is the cause?
If the Update frequency is too low, is there a way I can increase it?
If not, what can I do about it?


Unfortunately, there will always be a slight delay.

You’re moving the mouse. Unity then has to know where the mouse has moved to, then translate that info to the game object, then the renderer has to render the changes, etc. Point being, if you consider the mouse as Process 1, the actual display of moving the box would be like, Process 10. Now, considering that you’re continually moving the mouse, it gets ramped up.

You said your game was a touch game. Cool. I understand you’re using a mouse during testing. Computer mice use acceleration. Your finger on a phone…would not. Export it to a phone, then see if the issue is as bad as it is with the mouse.

There isn’t a way to increase the update, as it’s the “fastest” firing method. (Multiple times per frame)