A complete death and respawn system has been implemented for your dungeon crawler. The system features:
In your Unity scene hierarchy, create these GameObjects:
1. Create Empty GameObject: "GameManager"
2. Add Component: GameManager.cs
3. In Inspector, assign:
- Team Cohesion Manager (reference from scene)
- Checkpoint System (create next)
- Death Screen UI (create later)
- Player Movement (GridMovement component on player)
4. Configure settings:
- Death Delay: 2 seconds (default)
- Respawn Fade Time: 1 second
- Reset Monsters On Respawn: ☐ (optional)
- Apply Gold Penalty: ☐ (disabled by default)
1. Create Empty GameObject: "CheckpointSystem"
2. Add Component: CheckpointSystem.cs
3. In Inspector, assign:
- Cohesion Manager (reference from scene)
- Player Transform (your player GameObject)
- Player Movement (GridMovement component)
4. Settings:
- Auto Save On Checkpoint: ☑ (enabled)
- Checkpoint Radius: 3 meters
1. Create Empty GameObject: "DeathScreenUI"
2. Add Component: DeathScreenUI.cs
3. The script will auto-create the UI if not manually designed
4. Optional: Customize death messages in Inspector array
5. Settings:
- Fade In Duration: 1 second
- Randomize Message: ☑ (enabled)
To add checkpoint zones throughout your dungeon:
1. Create Empty GameObject at desired checkpoint location
2. Name it: "Checkpoint_01" (or descriptive name)
3. Add Component: BoxCollider
4. Add Component: CheckpointTrigger.cs
5. In Inspector:
- Box Collider: Set size (e.g., 5x3x5) and mark as Trigger
- Show Visual Feedback: ☑
- One Time Use: ☑ (recommended)
- Checkpoint Message: "Safe Zone Reached"
6. Tag the object as "Checkpoint" (optional)
Note: Yellow wireframe cube shows checkpoint location in Scene view.
Your existing scripts have been updated automatically:
CharacterUIController.cs - Now notifies GameManager on party wipeGameInitializer.cs - Saves initial checkpoint on game startEnsure your Player GameObject has:
| Setting | Default | Description |
|---|---|---|
| Death Delay | 2s | Time before death screen appears |
| Respawn Fade Time | 1s | Duration of fade transition |
| Reset Monsters On Respawn | false | Respawn all monsters (harder) |
| Apply Gold Penalty | false | Lose gold percentage on death |
| Gold Penalty Percent | 0% | How much gold to lose |
| Setting | Default | Description |
|---|---|---|
| Auto Save On Checkpoint | true | Save when entering checkpoint zones |
| Checkpoint Radius | 3m | Trigger distance for checkpoints |
| Setting | Default | Description |
|---|---|---|
| Show Visual Feedback | true | Play effects on activation |
| One Time Use | false | Only trigger once per checkpoint |
| Checkpoint Message | Custom | Log message on save |
If you want to design your own death screen instead of the auto-generated one:
1. Create Canvas → Panel in UI
2. Add background image (dark/ominous)
3. Add TextMeshPro text for death message
4. Add Button with "RESPAWN" text
5. Add CanvasGroup to panel
6. Assign references in DeathScreenUI Inspector:
- Death Panel: Your panel GameObject
- Death Message Text: Your TextMeshPro text
- Respawn Button: Your button
- Canvas Group: CanvasGroup component
Add visual flair to checkpoints:
1. Create particle effect prefab (glowing portal, sparkles, etc.)
2. Assign to CheckpointTrigger → Checkpoint VFX
3. Add checkpoint sound effect AudioClip
4. Effects play automatically when triggered
Enable penalties for hardcore mode:
// In GameManager Inspector:
Apply Gold Penalty: ☑
Gold Penalty Percent: 10-50%
// Or extend GameManager.cs to add custom penalties:
private void ApplyGoldPenalty()
{
// Your custom penalty logic
// Examples:
// - Lose items
// - Reduce experience
// - Drop equipped weapons
}
Call from your own scripts:
// Save checkpoint at current position
CheckpointSystem.Instance.SaveCheckpoint();
// Save checkpoint at specific location
CheckpointSystem.Instance.SaveCheckpointAt(position, rotation);
if (GameManager.Instance.IsPlayerDead())
{
// Disable certain features during death
}
// Trigger respawn manually
GameManager.Instance.RespawnParty();
Scene
├── GameManager (GameManager.cs)
├── CheckpointSystem (CheckpointSystem.cs)
├── DeathScreenUI (DeathScreenUI.cs)
├── Player
│ └── [GridMovement, TeamCohesionManager, etc.]
├── Canvas (UI)
│ └── PartyUIManager
├── Dungeon
│ ├── Checkpoint_Entrance (CheckpointTrigger)
│ ├── Checkpoint_MidLevel (CheckpointTrigger)
│ └── Checkpoint_Boss (CheckpointTrigger)
└── Monsters
Solution: Check that GameManager is in scene and DeathScreenUI is assigned.
Solution: Ensure CheckpointSystem is assigned to GameManager and initial checkpoint was saved.
Solution:
Solution: Make sure PartyUIManager exists in scene and is properly referenced.
Solution: Ensure saved checkpoint position has valid ground underneath.
┌─────────────────┐
│ MonsterAttack │ Deals damage to character
└────────┬────────┘
│
▼
┌─────────────────────┐
│ CharacterUIController│ Detects HP ≤ 0
└────────┬────────────┘
│
▼
┌──────────────────┐
│ TeamCohesion │ Checks if all dead
│ Manager │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ GameManager │ Orchestrates death/respawn
└────────┬─────────┘
│
├─► Fade to Black
├─► Show Death Screen
└─► On Respawn Click
│
▼
┌──────────────────┐
│ CheckpointSystem │ Restore party & position
└──────────────────┘
Before testing, verify:
Enhancement Ideas:
If you encounter issues:
[GameManager], [CheckpointSystem], [Death])All debug logs are prefixed with system name for easy filtering.
System Version: 1.0
Created: October 2025
Compatible with: Unity 2021.3+
Enjoy your robust respawn system! 🎮✨