Skip to content

Fix singleton replacement logic and add debug logging for moves#3

Open
ehalsey wants to merge 6 commits intoRimaethon:masterfrom
ehalsey:erics-base
Open

Fix singleton replacement logic and add debug logging for moves#3
ehalsey wants to merge 6 commits intoRimaethon:masterfrom
ehalsey:erics-base

Conversation

@ehalsey
Copy link

@ehalsey ehalsey commented Dec 6, 2025

Summary

  • Fix StaticInstance singleton to destroy the old instance instead of the new one, ensuring scene transitions properly replace managers
  • Add debug logging to InputHandler for move count changes to aid debugging

Test plan

  • Verify singleton managers are properly replaced during scene transitions
  • Check console logs show move count debug messages when swapping gems or using boosters

🤖 Generated with Claude Code

ehalsey and others added 6 commits October 27, 2025 20:42
This commit addresses critical runtime errors preventing the game from starting
and functioning properly. The main issues were singleton initialization order
problems and missing AudioManager null checks.

Key Changes:
- Created ManagerBootstrap.cs to auto-initialize EventManager, SceneController,
  and EventSystem with proper InputSystemUIInputModule configuration before
  scene load
- Fixed InputSystemUIInputModule not tracking input by calling AssignDefaultActions()
- Added null checks for EventManager.Instance in OnEnable() methods across
  9 UI components to prevent crashes when singletons aren't ready yet
- Added comprehensive AudioManager.Instance null checks (14 locations) to allow
  game to run without sound until AudioManager is properly configured
- Fixed AWS initialization exception handling in RemoteContentManager
- Fixed null reference errors in InputManager, TimeManager callbacks
- Created diagnostic utilities:
  * ClickDebugger.cs - Comprehensive UI input debugging tool
  * FixCanvasCameras.cs - Auto-assigns Main Camera to ScreenSpaceCamera canvases

Files Modified:
- Core: InputHandler.cs, MatchHandler.cs
- Managers: EventManager.cs, SaveManager.cs, SceneController.cs, TimeManager.cs,
  RemoteContentManager.cs, PostProcessingManager.cs
- UI: UIButton.cs, MainMenuUIManager.cs, LevelPanel.cs, EventButton.cs,
  StarResourceBar.cs, HeartResourceBar.cs, CoinResourceBar.cs, FortuneWheelEvent.cs
- Items: GeneratorItem.cs, TNTBooster.cs, HorizontalRocketBooster.cs,
  VerticalRocketBooster.cs, StoneObstacleBoardItem.cs, LightGrassUnderLayBoardItem.cs,
  DarkGrassUnderlayBoardItem.cs
- Input: InputManager.cs

Result: Game now starts successfully, UI buttons work, gem swapping and matching
functions properly. Game runs without crashes but without sound until AudioManager
is configured in scenes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Change button click check from isActiveAndEnabled to interactable
- Force all UIButtons to be interactable on Awake
- Move LevelCreator to Editor folder (build compilation fix)
- Add comprehensive diagnostic logging for button clicks
- Add BoardSpriteSaveData editor-only preprocessor directives
- Switch scripting backend to Mono (IL2CPP not installed)

Issue: SaveManager file paths still need fixing for standalone builds
Fixed multiple issues to create a playable standalone Windows build:
- Build system now uses Mono2x backend to avoid IL2CPP installation requirement
- File paths updated to use StreamingAssets and persistentDataPath for builds
- Editor-only code separated with preprocessor directives
- Scene loading starts on MainMenuScene instead of auto-loading gameplay
- Camera and UI scaling adjusted so all 10 gem rows are visible with top/bottom panels
- Gems scaled to 2x individually for better visibility and proper grid alignment

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix grass sprite scaling: Changed spritePixelsToUnits from 950/975 to 530 to match gem size
- Restore SceneController auto-load of MainMenuScene (scene 1) on startup
- Fix BoardSpriteSaveData preprocessor directive syntax error
- Fix TNTRocketMergeAction crash: Add AudioManager null checks
- Fix ProgressBarPanel crash: Add _eventData null check in GetRemainingTime
- Camera orthographic size: 6 (provides proper UI spacing)

These fixes resolve:
- Game not displaying main menu on startup
- Grass blocks appearing too small relative to gems
- Game freezing when combining TNT + Rocket boosters
- ProgressBarPanel crash during time updates
- Add null checks in TopLayerCanvasManager to prevent crash when level completes
- Fix grass sprite scaling (LightGrass/DarkGrass to 2200 to account for 2x image size)
- Fix mailbox sprite scaling (550 to 1100 to match stone blocks)
- Adjust board position for better centering (x: -0.3 to -0.6, y: -4.5 to -4.2)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix StaticInstance to destroy old singleton instance instead of new one,
  ensuring scene transitions properly replace managers
- Add debug logging to InputHandler for move count changes to aid debugging

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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