- Home /
Mouse cursor for pixel perfect game
Hi, How to make the mouse cursor fit to the rest of the game sprites in pixel perfect game? I set my game to be 320 on 200 pixels and all the sprites are 1 pixel per unit. When I add a sprite for the cursor (tried to make its settings Cursor or Sprite) its not fit the other sprites and it's smaller than what it intended. Thanks!
Answer by DawidNorasDev · Jul 05, 2018 at 12:14 PM
How about making a gameObject and treating it as an coursor. You will be able to move it by script pixel by pixel. You will detect mouse movement with invisible mouse pointer, and move the sprite mouse pointer you created.
Answer by LEDWORKS · Jul 05, 2018 at 01:06 PM
Set the cursor like this...
Vector2 hotspot = Vector2.zero;
Cursor.SetCursor(_Cursor, hotspot, CursorMode.Auto);
Texture type is set to Cursor not Sprite.
For 100% pixel accuracy, you want the tip of your cursor texture on the top left pixel.
hotspot determines the pixel that is the tip of your Cursor
Your answer
Follow this Question
Related Questions
Unity2D Pixels deforming when moving 0 Answers
Pixel art is jittery while moving camera. 2 Answers
Unity 2D URP No Tilemap Shadows 2 Answers
Pixels per unit - Unity 1 Answer
Pixel perfect crosshair. 1 Answer