What is CreateTileFromPaletteAttribute used for and how?
You can create a method with this attribute and set it in the Tile Palette preferences. When dragging Sprites or Textures onto the Tile Palette, it will call that method instead of creating a default Tile.
The following is an example of creating a Tile which is tinted Red when Sprites or Textures are dragged to the Tile Palette:
public class CreateRedTile
{
[CreateTileFromPalette]
public static TileBase RedTile(Sprite sprite)
{
var redTile = ScriptableObject.CreateInstance<Tile>();
redTile.sprite = sprite;
redTile.name = sprite.name;
redTile.color = Color.red;
return redTile;
}
}
Thank You! I did not know about the Tile Palette preferences. Wouldn’t a method per palette instead of a global one make more sense?
What about just moving that drop-down list to the Tile Palette window? Better workflow, same versatility…
This sounds like a good idea! We will check it out, thanks!