Try inheriting from TileBase. “Tile” might be using a custom Inspector, suppressing the normal inspector showing the float. You could also make your own custom Inspector if you want something fancy.
Where you have your wood, each wood references the same Tile. There reason why the GridSelection tool doesn’t give you its properties like that is that would imply that you can edit per-tile properties, which you cannot. All wood have the same Speed. In other words, when looking at a particular position, if there’s a wood there, you can’t adjust the speed for that position, only across all places where there’s wood by changing the asset (in project window). So, GridSelection only tells you what Tile asset is at a particular spot. You can then adjust that asset’s properties from the Inspector for the asset.
works because of the same reason?
When I was looking into the example I thought this isn’t right, that it would only be true when the instance of the RoadTile is at that specific position, and that the correct version for the function would be something like this:
But it would be also surprising if such a mistake went unnoticed in the documentation for more than two years, so I started to look into the forum.
But it feels like now I get it, there is only one RoadTile instance which can be present in multiple cells in the Scene, that is why it works with the “== this”. Is this correct?
Is there a case where there would be multiple RoadTile instances in the same Scene?
That is correct. “== this” is doing reference comparison. Keep in mind, you could create multiple tile assets of the same road tile script. Then the “==this” is checking whether this instance (i.e. this asset) is the same as that instance at the particular cell.
Yes, create a RoadTile asset. Then copy and paste it in the Project. Then paint both to the same tilemap. Now you have multiple on the same tilemap.
And in the case that I want an editable property on a per-tile basis how should we go about it? For example, I might set up a tile that can be burned, then once burnt I want to be able to set and check a boolean “isBurnt” and potentially do other actions (such as changing its sprite or burning neighbor tiles among others)
The problem with #1 would be that the power of using the Tile Palette would be lost, which would be a shame since it speeds up the creation of the maps a ton. For #2 I’ve seen that Unity offers the GridInformation script, even though it is not supported anymore, but with that solution then we lose the power of using the inspector to quickly edit each tile settings.
I think it is a lose-lose situation with each solution without a way around
With #2, the overall strategy is to keep a strict separation between the Visual Layer and the Gameplay Layer. The tilemap becomes a visual representation of gameplay data rather than being associated with any tiles themselves. This is more suitable for certain types of games (simulations) than others (pre-designed levels).
With any solution, you may find you need to build an in-game or editor tool to print information. The GridInformation is never going to be able to print everything you may need, especially if you want lots of custom data. The #1 solution with Prefab/GameObjects can still make use of the Inspector. There’s also this free asset which I haven’t used but aims to solve this problem.