Over the last year I’ve done a lot of experimenting with Unity’s tile system. I keep coming across one particular headache over and over again. Extending the tile class in any way, shape, or form. Maybe someone can help me or we can get something changed.
Take a very simple example. Say I want a surface type, so I know what sound to play when a tile is stepped on, or perhaps I want to find specific tiles programmatically to add doodads.
using UnityEngine;
using UnityEngine.Tilemaps;
public class SurfaceTile : Tile
{
[SerializeField] public Controller2DSurface.SurfaceTypes surfaceType;
}
You’ve already got your normal tile assets. Not every tile needs to be a SurfaceTile right? So we just need to apply this script to a few tile assets and we’re done. Easy, right? No. Because as far as I can tell at no point has Unity considered this use case. You have to enter Debug Mode and change the script on the ScriptableObject.
This functions. You’ll get your custom tile behaviors working, but since you can’t multi-edit while changing scripts, be prepared to change every single one of your hundreds of tile assets manually. You are now also locked out of Unity’s hidden custom editor features which is practically a deal breaker. No rule tiles. Not even sprite previews in the Project view. And the Tile script is protected and can’t be reselected from Unity’s explorer, so you will never be able to revert anything.
Someone please tell me I’m wrong about this and there’s a simpler way. Creating custom tile behavior is too useful. Tilemap Extras is nice, but Unity will never be able to anticipate every single thing a dev might want to do with tiles and stepping off the beaten path is this difficult isn’t really great for creativity.
And I’m not the only one with the headache. I’ve seen countless assets on the store have to rewrite the entire RuleTile editor GUI to add support for custom behavior like this. It’s actually insane. What’s the deal here?