[BUG] CharacterStore: Missing DontDestroyOnLoad causes NullRefs on scene load #7

Closed
opened 2026-03-12 00:02:29 +00:00 by lavarius · 1 comment
Owner

🔴 Critical Bug

File: CharacterStore.cs

This singleton gets destroyed on scene load, causing NullReferenceException in any system that holds a reference to it across scenes.

Fix: Add to Awake():

DontDestroyOnLoad(gameObject);
## 🔴 Critical Bug **File:** `CharacterStore.cs` This singleton gets destroyed on scene load, causing `NullReferenceException` in any system that holds a reference to it across scenes. **Fix:** Add to `Awake()`: ```csharp DontDestroyOnLoad(gameObject); ```
Collaborator

Fixed in PR #31 (feat/persistent-character-system).

CharacterStore.Awake() now calls DontDestroyOnLoad(gameObject) with a singleton guard to destroy duplicates. The character is spawned once in the Loading Screen and persists across all scene transitions. Each game scene has a CharacterSpawnPoint + CharacterSceneInitializer that teleports it to the correct position on arrival.

Fixed in PR #31 (`feat/persistent-character-system`). `CharacterStore.Awake()` now calls `DontDestroyOnLoad(gameObject)` with a singleton guard to destroy duplicates. The character is spawned once in the Loading Screen and persists across all scene transitions. Each game scene has a `CharacterSpawnPoint` + `CharacterSceneInitializer` that teleports it to the correct position on arrival.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lavarius/ProjectOverlay#7
No description provided.