I’m making a mario maker style game where everything has to snap to a grid. I want to, while I’m dragging it, have the item snap into place closest to each int.
void FixedUpdate () {
Vector2 pos = Input.mousePosition;
pos.x = Mathf.Round(pos.x);
pos.y = Mathf.Round(pos.y);
pos = Camera.main.ScreenToWorldPoint (pos);
transform.position = pos;
}
This does not work for me, and I’ve been trying for hours to fix this. Nothing has helped so far, I’ve gone through every forum I could find to no avail. Please help!!