Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //All these null checks in order to make absolutely sure the null reference can not occur... And yet it does.
- public void SetShouldShowAgent()
- {
- var currentIdentity = BlackboardController.GetCurrentPlanIdentity();
- var gameData = GameDataContainer.GetGameData();
- if (currentIdentity == null || gameData == null) return;
- if (currentAgent == null) return;
- bool shouldShowAgent = true;
- if (!gameData.agents.Contains(currentAgent)) shouldShowAgent = false;
- if (!currentAgent.IsAvailable(currentIdentity.target)) shouldShowAgent = false;
- if (shouldShowAgent) gameData.StoreAgentMissionPlanningPosition(currentIdentity, currentAgent, (Vector2)transform.localPosition);
- if (this == null || gameObject == null) return;
- gameObject.SetActive(shouldShowAgent); //<---- Exception hits here
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement