79366439

Date: 2025-01-18 01:43:52
Score: 1
Natty:
Report link

Update is called once per frame so you shouldn't be setting the player to alive there.

To know for sure that a player is dead, you'll need to access your game manager through your player, and upon death, call a public game manager method that will set the player alive to false. This is a more efficient way than to have the game manager check in Update() whether the player is alive.

You can also just keep score on the player object itself, and just allow the game manager / other objects to get it and update it. Then when the game is over, and you destroy the player object, the score will reset to 0 when you create a new game.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Dina