i’m getting a nullreferenceerror like such after i kill an enemy unit and end my turn: MissingReferenceException: The object of type ‘TextMeshProUGUI’ has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnitWorldUI.UpdateActionPointsText () (at Assets/Scripts/Unit/UnitWorldUI.cs:36)
UnitWorldUI.Unit_OnAnyActionPointsChanged (System.Object sender, System.EventArgs e) (at Assets/Scripts/Unit/UnitWorldUI.cs:24)
Unit.TurnSystem_OnTurnChanged (System.Object sender,
i checked the scene heirarchy and that enemy unit seems to have been properly destroyed. i have temporarily fixed it by adding in a unit ==null check in the unitworldui class but it seems to be hacky; i’m not why the unitworldui is still running for the destroyed gameobject. not sure where else to check why that instance of the class is still alive. can it have something to do with unsubscribed event handlers in c#?