First of all, great course still! Love to see you back from the holidays.
When clicking the game area without first clicking on a defender to build I get the following error:
“NullReferenceException: Object reference not set to an instance of an object
DefenderSpawner.AttemptToPlaceDefenderAt (Vector2 gridPos) (at Assets/Scripts/DefenderSpawner.cs:23)
DefenderSpawner.OnMouseDown () (at Assets/Scripts/DefenderSpawner.cs:12)
UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32)”
It seems to be in this part of the code:
private void AttemptToPlaceDefenderAt(Vector2 gridPos)
{
var StarDisplay = FindObjectOfType<StarDisplay>();
int defenderCost = defender.GetStarCost();
if (StarDisplay.HaveEnoughStars(defenderCost))
{
SpawnDefender(gridPos);
StarDisplay.SpendStars(defenderCost);
}
}
Any thoughts?