- Home /
How to access a tile?
I am currently working on a game and have been trying to find out how to access a tile so that my script can place it when generating the tile-based game map. I would also like to know if I could check to see if a tile exists in order to set limits on the player characters movement.
Hello.
You titlte must explain what are you looking for, not your final propuse. You are not asking how to randomly generate a tilebased map, you are asking how to acess a tile. So change the title.
Answer by tormentoarmagedoom · Apr 07, 2020 at 10:15 AM
HEllo, regarding your problem,
The basit method for that is the function GetTile()
https://docs.unity3d.com/ScriptReference/Tilemaps.Tilemap.GetTile.html
For easy finding tiles. you should do tiles size of 1,1 or 10,10 or something like this so can easy find them.
Another way to "find" tiles can be by raycasting, or via Colliders (creating some prefab that you can instantiate on the map and collide with tiles to detect them).
You should investigate (google, youtube, Unity answers) this by your own before coming here to ask. There are many posts about this topic.
Good luck.