Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Getting tile name from Tile Rule

Discussion in 'Getting Started' started by nthanhphong941, Apr 25, 2024.

  1. nthanhphong941


    Feb 8, 2023
    Hi, I am new to Unity. I am creating a simple platform game in which the player will control a mouse character to get all the cheeses in time. I have a function to get all the valid positions in order to spawn the cheese around these tiles. The Tile Rule contains Dirt and Grass tilemap. I use to check if it is grass or dirt tilemap but it only returns Grass Tile Rule. How can I get the name of the tile in the Tile Rule?
  2. Murgilod


    Nov 12, 2013
    It's a little unfortunate that this got moved to Getting Started because this is actually a somewhat obscure limitation of the Rule Tile system. You can't get the name of a rule tile, but you can get the name of the sprite if you feed the cell into TileMap.GetSprite. This means you'll have to take care with your sprite names, but it's an option at least.