using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
public class TestScript : MonoBehaviour
{
[SerializeField]
private Tilemap tilemap;
public string sText;
void Start()
{
}
// Update is called once per frame
void Update()
{
var targetPos = UnityEngine.Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector3Int targetPosInt = tilemap.WorldToCell(targetPos);
transform.position = new Vector2(targetPosInt.x + 0.5f, targetPosInt.y + 0.5f);
Sprite spr = tilemap.GetSprite(targetPosInt);
if(spr != null)
sText = spr.name;
else
sText = "";
}
}