Im trying to make a gold storage snap to the position of the mouse on the x and y axis for every 5 units. Don’t know why this isnt working any suggestions (very very new to coding in general lol)
void Update () {
if (Input.GetMouseButtonDown(0))
{
selectedObject = goldStorage.transform.position;
var currentPosMouse = Input.mousePosition;
selectedObject = new Vector3(Mathf.Round(currentPosMouse.x * 5), Mathf.Round(currentPosMouse.y * 5));
}
}