::So far, your code seems correct. So let’s start looking through your Scene’s inspector while in this death screen that can’t be removed.
Please open up the Canvas and look through it’s inspector values while you are dead, as well as the respawn button under “Death Screen” for it’s event system to see if it still has the GameManager on it.
I’ll also need you to manually deactivate the death screen during the bug and see if the player has respawned, thus meaning for some reason, only the DeathScreen is still active, or everything for the respawn did not function.
Then, we’re going to need to see if all parts of the code are being called correctly, add print code’s to your GameManager.cs RespawnPlayer()
:
public void RespawnPlayer()
{
if(bench.interacted) {
respawnPoint = bench.transform.position;
} else {
respawnPoint = platformRespawnPoint;
}
playerController.Instance.transform.position = respawnPoint;
print("player position set")
StartCoroutine(UIManager.Instance.DeactivateDeathScreen());
print("deactivate death called")
playerController.Instance.Respawned();
print("player called to respawn")
}
Then do the same for your UIManager.cs:
public IEnumerator DeactivateDeathScreen() {
print("UIman deactive started")
yield return new WaitForSeconds(0.5f);
deathScreen.SetActive(false);
print("screen setactive false")
StartCoroutine(sceneFader.Fade(SceneFader.FadeDirection.Out));
print("fade called")
}