I’ve made a laser in 2D that draws a line from the player to the hit collider with Raycast2D and shaders. I then got the tilemap from hit and the specific grid coords with this script:
Tilemap mineable = hit.collider.GetComponent<Tilemap>();
Vector3 hitPosition = hit.point;
hitPosition.x = hit.point.x;
hitPosition.y = hit.point.y;
Vector3Int gridCell = mineable.WorldToCell(hitPosition);
However I want to make it so that the laser takes time to destroy the tiles, so I added a default gameobject (prefab) with a float for durability to the ruletile that I use to draw the mineable tiles.
The problem is, how do I reference the specific hit tile in such a way that I can change the durability value from the hit tilemap “mineable”?