In the earlier part of the Realm Rush course the CoordinateLabeler script was able to update not only the coordinate text on the tiles in Editor mode Scene view but also the colors. It would show white text on the labels if the tile was unblocked (isPlaceable) and grey text if the tile was marked as blocked. However, after the refactoring about halfway through where pathfinding and the grid node systems were introduced this no longer functions in Editor mode. The colors get set fine in play mode, but in the Editor they do not update when the “Is Placeable” flag is changed on a tile.
At first, I thought this was just my code. But I have also downloaded the final GameDev.tv project files from Gitlab and ran it only to find out it doesn’t work in the instructor’s version either.
My debugging indicates this is because CreateGrid() is only called in Awake() within the GridManager script. It never gets called in Editor mode, only when the game is running. Therefore, SetLabelColor() in CoordinateLabeler fails to work because all nodes are null (they are only created in Game runtime, not Editor).
So I guess the purpose of my post is twofold. First, to let you know so maybe you can fix this in Realm Rush course. Secondly, to ask how one might solve this? I though perhaps making CreateGrid() a public function and calling it from CoordinateLabeler, but there are problems with this approach.