Check if tile is derived from given RuleTile?

I want to check if a Tile object is derived from a RuleTile class. For instance,

if (myRuleTile.MatchesRuleTile(tile)) {
  // do something
}

How do you do this?

To check this, all you need to do is compare instances because all tiles in a tilemap derived from the same tile share the same instance. That’s what makes Tilemaps very memory efficient!

if(someTile == someRuleTile)
{
  // do something
}

You can double-check this by comparing the unityObject.GetInstanceID() or the name.

1 Like

Awesome, that’s just what I wanted. Thanks!