Skip to content

feat: Merge upstream#5

Merged
bitsandfoxes merged 14 commits into
mainfrom
feat/merge-upstream
Feb 17, 2026
Merged

feat: Merge upstream#5
bitsandfoxes merged 14 commits into
mainfrom
feat/merge-upstream

Conversation

@bitsandfoxes
Copy link
Copy Markdown
Collaborator

Pulling the latest and greatest from getsentry/sentaur-survivors and updating the demo to run from a commandline argument.

Comment on lines +49 to +57
public static DemoConfiguration Load()
{
if (_instance == null)
{
_instance = Resources.Load("DemoConfig") as DemoConfiguration;
_instance?.ApplyRuntimeOverrides();
}
return _instance;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The static DemoConfiguration singleton doesn't clear its _instance on destroy. Scene transitions using LoadSceneMode.Single can cause it to hold a dangling reference to a destroyed object.
Severity: HIGH

Suggested Fix

Implement an OnDestroy() method in DemoConfiguration.cs. Inside this method, check if the current instance _instance is the one being destroyed, and if so, set the static _instance field to null. This ensures that the singleton is properly re-initialized after a scene unload.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: Assets/Scripts/Config/DemoConfiguration.cs#L49-L57

Potential issue: The static `DemoConfiguration` singleton loads a ScriptableObject into
a static `_instance` field but lacks an `OnDestroy` method to nullify this field. When a
scene transition occurs using `LoadSceneMode.Single`, Unity unloads unused assets,
including the `DemoConfiguration` object. Because the static `_instance` reference is
not cleared, subsequent calls to `DemoConfiguration.Load()` in a new scene will
incorrectly return the stale reference to the destroyed object. Accessing any properties
on this returned object will result in a `UnityEngine.MissingReferenceException`,
causing a crash.

Did we get this right? 👍 / 👎 to inform future reviews.

@bitsandfoxes bitsandfoxes merged commit 3b4a6b5 into main Feb 17, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants