Troubleshooting
Common issues, error messages, and solutions.
Common Issues
Cause: The game wasn't launched from GameTribe, so there's no session token in the URL.
Solution:
- In development, enable
mockAPIResponses = truein your PlatformConfig - In production, ensure the game is launched via GameTribe (not directly)
- For testing with real tokens, copy the full URL from GameTribe including query parameters
Cause: The session or user token is invalid or expired.
Solution:
- Check that your API Key and Game ID are correct in PlatformConfig
- Verify the backend URL is correct
- Sessions expire after 24 hours — refresh the game page
- Check backend logs for more details
Cause: PlatformSDK component isn't in the scene or hasn't initialized yet.
Solution:
- Ensure a GameObject with
PlatformSDKcomponent exists in your scene - Wait for
OnSDKReadybefore accessing SDK features - Don't destroy the SDK GameObject when loading scenes
// Always wait for SDK readyvoid Start(){PlatformSDK.Instance.OnSDKReady += () =>{// Now safe to use SDK};}
Cause: Score submission is asynchronous or the session wasn't ended properly.
Solution:
- Always call
EndSessionAsync()with the final score - Wait 1-2 seconds for backend processing before refreshing the leaderboard
- Check that the session was active (IsSessionActive = true)
- Verify the response from EndSessionAsync shows success = true
Cause: Events are batched and not sent immediately, or there's a configuration issue.
Solution:
- Check API Key and Base URL in PlatformConfig
- Call
FlushAsync()inOnApplicationQuit() - Enable
debugMode = trueto see event logs - Verify network connectivity
Cause: API Key doesn't match the game or authentication token is invalid.
Solution:
- Double-check your API Key matches the one in the GameTribe dashboard
- Ensure you're using the correct Game ID
- Verify the game was created in the dashboard before testing
Cause: mockAPIResponses is still enabled.
Solution:
- Set
mockAPIResponses = falsein your PlatformConfig - Create separate config assets for development and production
Cause: WebGL-specific issues with JavaScript bridge or CORS.
Solution:
- Ensure the game is served from the same domain or CORS is configured
- Check browser console for JavaScript errors
- Verify the WebGL build includes the Plugins/WebGL folder
- Test with a simple HTTP server, not file:// protocol
Debugging
Enable Debug Mode
Enable detailed logging in your PlatformConfig:
// In PlatformConfig:debugMode = true; // Basic debug logsverboseLogging = true; // Extra detailed logs
Check Session State
void DebugSessionState(){var session = PlatformSDK.Instance.Session;Debug.Log($"SDK Initialized: {PlatformSDK.Instance.IsInitialized}");Debug.Log($"Session Active: {session.IsSessionActive}");Debug.Log($"Session ID: {session.SessionId}");Debug.Log($"Session Token: {session.SessionToken}");if (session.PlayerStats != null){Debug.Log($"High Score: {session.PlayerStats.highestScore}");Debug.Log($"Rank: {session.PlayerStats.rank}");}}
Check Event Queue
void DebugEventQueue(){int queued = PlatformSDK.Instance.Events.GetQueuedEventCount();Debug.Log($"Events in queue: {queued}");}
Error Codes
| Code | Message | Solution |
|---|---|---|
| 401 | Unauthorized | Check API Key and tokens |
| 403 | Forbidden | Game ID doesn't match API Key |
| 404 | Not Found | Invalid endpoint or session expired |
| 429 | Too Many Requests | Rate limited — reduce request frequency |
| 500 | Server Error | Backend issue — retry or contact support |
FAQ
Yes! Enable mockAPIResponses = true in your PlatformConfig. The SDK will return mock data for all API calls, allowing you to develop and test without a backend connection.
Events are queued locally and retried with exponential backoff. If the player goes offline during gameplay, events will be sent when connectivity is restored. For critical events like scores, implement your own local storage as backup.
Leaderboard rankings are computed asynchronously. The scoreRankfield in EndSessionResponse may be null initially. Poll the leaderboard API after a few seconds to get the updated rank.
Yes! The SDK works in the Editor with mock responses enabled. Token extraction from URL only works in WebGL builds, so use mock mode or manual token injection for Editor testing.
Tournaments are handled automatically by the backend. When you submit a score viaEndSessionAsync() or SubmitScore(), the backend checks for active tournaments and enrolls the player automatically. No SDK changes are needed.
Getting Support
If you're still having issues:
- Check the browser console (F12) for JavaScript errors
- Enable debug mode and check Unity console logs
- Review backend logs in the GameTribe dashboard
- Contact support with your Game ID and error details