- Home /
How to prevent mouse lag/latency for custom cursor?
(1) VSync is turned off. Turning it on makes no effects.
(2) code here:
// in the script of the cursor object...
protected virtual void Update()
{
this.gameObject.transform.position = VirtualCursor.position;
}
public static class VirtualCursor
{
public static Vector2 position
{
get
{
return new Vector2(Input.mousePosition.x, Input.mousePosition.y)
.Clamp(Vector2.zero, new Vector2(Screen.width - 1, Screen.height - 1));
}
}
........
}
(3) This video shows the latency is still obvious...
(4) Using OpenGL Core as graphics backend makes it a little better, but not enough.
Try doing an actual build, and seeing if the lag is still there.
Testing anything in the unity editor will always not be as 'reliable' as an actual build is.
Oh the build version works great !... The lag is still there but is not so obvious if the original cursor is hidden.... Thanks a lot..
What kind of renderer is the cursor? 2D Sprite? $$anonymous$$eshRenderer? UnityGUI?
Try giving the computer a good restart and clear your project temp files?
Side note: I suggest setting Cursor.lockState to CursorLock$$anonymous$$ode.Confined over your coordinate clamping, and using Cursor.SetCursor to simply change the texture used for the cursor.
sorry
It's a UGUI RawImage. Restarting doesn't work. This shouldn't be the case.. Setting lock mode to Confined will really confine the cursor inside the game window, while clamping makes cursor that is not inside the window work as just on the edge of the window.
Your answer
Follow this Question
Related Questions
How to get the current cursor texture? 0 Answers
How do I make my cursor smaller? 2 Answers
Resizing cursor to screen size 0 Answers
How Do I Lock the Cursor to the Center of the Screen? 1 Answer
Cursor Resize? 1 Answer