Problem: When the 'serverbrowserpkg' asset bundle file is missing,
the mod crashed at multiple points:
- PrefabManager.PreScriptLoad(): NullReferenceException on line 58
- ServerBrowser.SceneLoaded(): "Object to instantiate is null" at line 312
- Main.TransitionTo(): NullReferenceException at lines 227-228
These crashes made the mod unusable and prevented proper error reporting.
Root cause:
The asset bundle file containing UI prefabs was missing from the mod
directory, causing all prefab references to be null. The code didn't
check for null before using these references.
Solutions:
PrefabManager.cs:
- Add null check after LoadAssetBundle() call (line 31-36)
- Return early with clear error message if bundle is null
- Provide guidance to user about missing file
- Better logging for successful loads
ServerBrowser.SceneLoaded():
- Add prefab null check at method start (line 302-309)
- Return early if prefabs are null
- Prevents crash during UI instantiation
- Clear error messages in log
Main.TransitionTo():
- Add comprehensive null checks before using UI references (line 228)
- If UI not loaded but user tries to access multiplayer menu:
* Show user-friendly modal dialog
* Explain the problem clearly
* Provide reinstall guidance
- Gracefully handle missing UI without crashing
Results:
✅ No crashes when asset bundle is missing
✅ Clear, actionable error messages for users
✅ Graceful degradation - rest of mod still works
✅ User gets helpful modal instead of silent crash
✅ Better debugging with detailed logs
Updated README.md with:
- Documentation of all asset bundle fixes
- Code examples showing the changes
- Known Issues section noting missing asset bundle
- Instructions for resolving the issue
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>