How do I place a custom tile?
I have created a scriptable object with this script. How do I use it in a tilemap? It allows it to be dragged into the tile pallette, however nothing shows up in there, despite having its sprite set.
using UnityEngine; using UnityEngine.Tilemaps;
[CreateAssetMenu()] public class SectorTile : Tile { [Header("Sector things")] public Vector3Int myPosition; public int ownerFaction; int level;
 public int[] factionsInside;
 public float captureProgress;
 public SectorTile(Vector3Int position, Tilemap tilemap, int level, int ownerFaction)
 {
     this.myPosition = position;
     this.level = level;
     this.ownerFaction = ownerFaction;
     ownerFaction = 0;
 }
 public void GetTileData()
 {
 }
 public void ICapture(int newFaction)
 {
     this.ownerFaction = newFaction;
     this.color = Utility.GetColorFromId((byte)newFaction);
 }
 public void AddFactionMember(int factionID)
 {
     factionsInside[factionID]++;
 }
 public void RemoveFactionMember(int factionID)
 {
     factionsInside[factionID]--;
 }
 public bool captureAble(int team)
 {
     for (int i = 1; i < 10; i++)
     {
         if (i == team) continue;
         if (factionsInside[i] > 0) return false;
     }
     return true;
 }
}
Answer by CheekySparrow78 · Dec 10, 2019 at 11:14 PM
I believe you have to inherit from Tilebase, not Tile. At least my custom tiles DO show in tile palette. I am still puzzled how to place them programmatically, though.
Your answer
 
 
             Follow this Question
Related Questions
How do I create tiles that I can add scripts to, and have players interact with? 0 Answers
Changing ScriptableObject to another during runtime crashes UnityEditor 0 Answers
Tile pallet doesn't exist in Unity 2019.2.12f1 personal! How to re-enable it? 1 Answer
Tile Tear in Unity 2 Answers
Problem with 2D tiles from a tilemap appearing blurry in game 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                