So, I made this script.
using UnityEngine;
using UnityEngine.Tilemaps;
public class ingameBuild : MonoBehaviour
{
public Tile highlightTile;
public Tilemap highlightMap;
[SerializeField]
// do late so that the player has a chance to move in update if necessary
private void LateUpdate()
{
// get current grid location
Vector3Int currentCell = highlightMap.WorldToCell(transform.position);
// if the position has changed
if(Input.GetMouseButtonDown(1))
highlightMap.SetTile(currentCell, highlightTile);
}
}
I can attach this code to an object. It doesn’t make the right thing. I either need to attach this to the cursor or make the object I attached this script exactly follow my cursor(with 0 delay, if you didn’t understand)