Your Pause Menu doesnt initialize anyYou are getting Null Pointer Exceptions for all of your GameObjectsthose errors.
Basically you are trying to use variables that you haven't initialized. For any private variable, you have to get a handle to the object with FindGameObject methods in your Start() before you can use it.
[SerializeField] private GameObject _attackButton;
[SerializeField] private GameObject _moveButton;
[SerializeField] private GameObject _pauseMenu;
[SerializeField] private GameObject _pauseButton;
So you're getting null pointer exceptionsYour first error, for instance is at
void Start () {
_isPaused = false;
_pauseMenu.SetActive(false);
}
private void HideButtonsInitializeVariables()
{
_attackButton.SetActive(false);
_player = _moveButton_player.SetActiveGetComponent<PlayerController>(false);
_pauseButton.SetActive(false);
_requiredScore = _pauseMenu.SetActive(true);10;
}
private void ShowButtons()
{
_player is still null, because you havent initialized it with FindGameObject like so
GameObject _attackButtonp=GameObject.SetActiveFindWithTag(true"Player");
_moveButton.SetActiveif(truep!=null);
_pauseButton_player=p.SetActiveGetComponent<PlayerController>(true);
From that point on, you need to always preface any calls to _player with
if(_player != _pauseMenu.SetActive(falsenull);
}
To fix, change your Start() functionIn order to FindGameObject()be safe if for each of your buttons and menus.some reason no object is tagged as Player