Class CreateTileFromPaletteAttribute
Use this attribute to add an option to customize how Tiles are created when dragging and dropping assets to the Tile Palette.
Implements
Inherited Members
Namespace: UnityEditor .Tilemaps
Assembly: Unity.2D.Tilemap.Editor.dll
Syntax
[AttributeUsage(AttributeTargets.Method)]
public class CreateTileFromPaletteAttribute : Attribute, _Attribute
Remarks
Append this attribute to a method that has a signature of "static TileBase CreateTile(Sprite sprite)".
Examples
using UnityEditor.Tilemaps;
using UnityEngine;
using UnityEngine.Tilemaps;
public class CreateBlueTile
{
[CreateTileFromPalette]
public static TileBase BlueTile(Sprite sprite)
{
var blueTile = ScriptableObject.CreateInstance<Tile>();
blueTile.sprite = sprite;
blueTile.name = sprite.name;
blueTile.color = Color.blue;
return blueTile;
}
}