I searched quite a bit and couldn’t find a solution, so hopefully there is a solution to the problem. Basically, I have the following, very simple class:
using UnityEngine;
using UnityEngine.Tilemaps;
public class GameTile : Tile
{
public bool locked = false;
}
This class defines the additional information I would like to retain as I build my Tilemap programmatically. then, I serialize this and a few other fields as follows:
using System;
using UnityEngine;
using UnityEngine.Tilemaps;
[Serializable]
public class TileInfo
{
public GameTile tile;
public int width;
public int height;
public bool locked;
}
The program that pulls this all together, making it available to the editor does the following:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
public class DrawTilemap : MonoBehaviour
{
[SerializeField]
public TileInfo borderInfo;
public TileInfo landInfo;
....
At this point, the editor looks good and has my fields available to populate:
When I click button to find the Tiles I want to add, nothing comes up. After searches the Internet, I found that I can type “t:Tile” to get a list of Tile type assets to show up in the project explorer; however, the editor will not allow me to drag those objects into the input for the GameTile type.
So, is there a way programmatically to trip the editor into thinking that GameTile type is Tile type? I thought since GameTile was derived from Tile that it would behave the same but that doesn’t appear to be the case…