My Game development

How do I create a game over screen in Unity?

When the player dies or runs out of lives, you display “GAME OVER” on the screen.

YouTube is a better resource for this kind of question - simple beginner-friendly video tutorials assuming little or no background knowledge.

1 Like

Probably, you need a script that will activate deactivated gameobject with canvas that contains your image and text
(or just text or TextMeshPro 3D without canvas)

Also you can do such trivial coding even with stupidiest GPT’s.

‘’’

using UnityEngine;
// You can put same name scripts in different namespaces
namespace PlayerLogic
{
 public class YourScript : MonoBehaviour
 {
   [SerializeField] private bool isDead;
   // Assign in inspector. Same as private, but worse  visual readability in code:
   [SerializeField] GameObject deathScreen; 

    Update()
    {
        if(isDead)
           {
              deathScreen.SetActive(true);
           }
     }

 }

}

Where to set true your bool you can choose yourself or just activate the screen right in place where the health reaches 0, for example

// Put in update
if(health <= 0) // Its should be already initialized like above, not necessary to serialize if public
   {
      deathScreen.SetActive(true); // Should be in script and assigned in inspector
   }

(examples are not from GPT)