In my script it dynamically makes a tiled map that has a script within each tile. Then, at some point, it will call a function within those scripts. The problem is that it doesn’t seem to find the scripts. So far I made this:
public void TestScript(){
List<Vector2Int> tiles = GetTilesInRange(new Vector2Int(size / 2,size / 2),3);
foreach(Vector2Int tile in tiles){
HighlightTest temp = mapTiles[tile.x,tile.y].GetComponent(typeof(HighlightTest)) as HighlightTest;
Debug.Log(temp.name);
}
}
I thought it would print “HighlightTest”, but instead it returns the name of the tile. How do I get the Script to recognize that it should get the script?