• 2D
  • Use Pixel Snap not working

Hello! I have a problem: Use Pixel Snap option does not work as I expect. This begs the question: do my expectations coincide with the real purpose of "Use Pixel Snap"?

Expectation: I am doing a low-resolution project, and I need each pixel to be strictly at an integer position. That is, if I move KinematicBody2D, the sprite attached to this node should move strictly along the pixel grid, respectively, the camera should behave in the same way. Therefore, I checked the Use Pixel Snap option.

Reality: This is not happening. Any graphic object when moving is positioned on a real pixel grid of the screen with a resolution of 1920X1080.

What am I doing wrong???

Found a solution. Apparently the problem was that I set Stretch / Mode to 2D instead of Viewport. I have no idea how this is connected. Apparently, I need to better explore the options.

@thomas_anderson The 2d stretch mode will stretch individual CanvasItems rather than the whole viewport. This is unrelated to the Use Pixel Snap setting, which ensures each CanvasItem's position is rounded to integer coordinates. This stretch mode is recommended for non-pixel art games (and some pixel art games, depending on what you want).

The viewport stretch mode will stretch the entire viewport, which prevents CanvasItems from visually moving by smaller increments than the viewport size allows (if pixel snap is enabled).