Skip to content

feat: gdc demo#7

Open
JoshuaMoelans wants to merge 16 commits intomainfrom
gdc-demo
Open

feat: gdc demo#7
JoshuaMoelans wants to merge 16 commits intomainfrom
gdc-demo

Conversation

@JoshuaMoelans
Copy link

@JoshuaMoelans JoshuaMoelans commented Mar 3, 2026

Adds a bunch of QoL and fixes for us to be able to demo at GDC 2026 using our handhelds


ℹ️ This PR is not necessarily meant to be merged into main in full; there is some pure QoL, but the GDC specific 'DLC' changes could be left on this branch. We might split this up into a separate PR that brings only the relevant stuff over into main


⚠️ there are some changes we have locally (e.g., DSN setup, Nintendo input package, leaderboard login) that are not pushed to remote, but are necessary to build the demo properly. These changes live in DemoConfig.asset (_apiUrl, user.Username and user.Password), packages-lock.json , SentryOptions.asset (<Dsn>k__BackingField))

Overview

fixes

  • fixes HTTP requests on Switch by changing to UnityWebRequest instead of httpClient.
  • update scorePoster to provide controller support; now on game over, we pop in the elements one by one, automatically selecting the enter name field once everything is loaded. This will trigger the built-in keyboards on our handhelds. When deselecting the field, we navigate to the 'submit' button, so users just confirm by X/A to send their score.
  • fixes double-score-sending which could happen if spamming the confirm key on the Submit button.
  • adds a 'crash' trigger button (pressing down the right joystick) that is active during gameplay. This uses a null pointer dereference instead of Utils.ForceCrash, since the latter did not work on Switch.
  • fixed aim snapping back to default angle when letting go of right joystick.

cosmetic changes

  • update splash screen icon to Sentry glyph
  • change DLC icon to be GDC edition
  • add score to game over screen

co-authored by Claude

@JoshuaMoelans JoshuaMoelans marked this pull request as ready for review March 3, 2026 07:35
Comment on lines +252 to +257
// WARNING, this also crashes in the Editor (on purpose, to easily test)
forceCrashAction.performed += _ =>
{
Debug.Log("ForceCrash triggered via input.");
Marshal.ReadInt32(IntPtr.Zero); // null pointer dereference — works on all platforms
};
Copy link
Author

Choose a reason for hiding this comment

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

our other 'crash on game over' does not trigger in the Editor, which makes sense since this also does crash the Editor itself... we could add the same safeguard here, I just kept it like this to make testing slightly easier.

@JoshuaMoelans
Copy link
Author

@sentry review

false, // multiline
false, // secure
false, // alert
_nameField.placeholder.GetComponent<TextMeshProUGUI>().text // placeholder text
Copy link

Choose a reason for hiding this comment

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

Bug: A potential NullReferenceException exists when opening the on-screen keyboard. The code accesses _nameField.placeholder without checking if it's null, which can cause a crash.
Severity: HIGH

Suggested Fix

Use the null-conditional operator (?.) and null-coalescing operator (??) to safely access the placeholder text and provide an empty string as a fallback: _nameField.placeholder?.GetComponent<TextMeshProUGUI>()?.text ?? "".

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/UI/ScorePoster.cs#L192

Potential issue: The code at `ScorePoster.cs:192` attempts to get the placeholder text
for the on-screen keyboard using
`_nameField.placeholder.GetComponent<TextMeshProUGUI>().text`. However, the
`_nameField.placeholder` property can be null if it's not assigned in the Unity editor.
This will cause a `NullReferenceException` when `GetComponent` is called on a null
object. A second `NullReferenceException` can occur if the placeholder exists but lacks
a `TextMeshProUGUI` component, as `.text` would be accessed on a null result. This will
crash the application on touch-supported devices when the user tries to enter their
name.

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

_buttonText.text = "Retry";
uploadTransaction.Finish(SpanStatus.InternalError);
}
}
Copy link

Choose a reason for hiding this comment

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

Bug: An HttpClient instance is created in Start() but is never disposed in OnDestroy(), causing a resource leak every time the scene is reloaded on non-Switch platforms.
Severity: MEDIUM

Suggested Fix

Implement the IDisposable interface on the ScorePoster class and call _httpClient?.Dispose() within the Dispose method. Then, call this Dispose method from OnDestroy() to ensure the HttpClient is properly cleaned up when the object is destroyed.

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/UI/ScorePoster.cs#L142

Potential issue: On non-Switch platforms, an `HttpClient` instance is created in the
`Start()` method of the `ScorePoster` component but is never disposed. Because the
`ScorePoster` is destroyed and recreated every time the scene is reloaded (e.g., when
the player clicks "Try Again"), a new `HttpClient` is leaked with each playthrough. This
consumes system resources like connection sockets, which can lead to performance
degradation, connection failures, or crashes over extended sessions, particularly in a
demo environment.

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

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.

1 participant