Skip to content

Improve code organization, readability, and asset path handling#48

Merged
amasiye merged 4 commits into
mainfrom
develop
Mar 15, 2026
Merged

Improve code organization, readability, and asset path handling#48
amasiye merged 4 commits into
mainfrom
develop

Conversation

@amasiye

@amasiye amasiye commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces significant improvements to the prefab and scene management system, focusing on robust prefab instantiation, safer cloning of game objects and components, and more flexible asset path resolution. The changes also include enhancements to serialization logic and error handling, as well as minor bug fixes and code quality improvements.

Prefab and Scene Loading Enhancements:

  • Added SceneManager::inflateGameObjectMetadata and SceneManager::loadPrefabFromPath to reliably instantiate prefabs from metadata, supporting flexible asset paths and improved error handling. Prefab loading now normalizes metadata and can resolve both absolute and assets-relative paths, with better error messages for missing or invalid prefabs. [1] [2] [3] [4]
  • Updated Prefab::load() to use the new SceneManager::loadPrefabFromPath method, simplifying prefab instantiation and ensuring consistency with the new prefab system.

GameObject Cloning and Serialization Improvements:

  • Overhauled the GameObject::__clone() method to deeply clone all serializable component state, ensuring prefab instances do not share mutable state. Added helper methods for extracting and duplicating serializable component data, and for reconstructing components for the clone.
  • Improved serialization logic in GameObject::__serialize() to always serialize the current sprite from the renderer, ensuring accurate prefab and scene state. [1] [2] [3]

Component Metadata Hydration:

  • Enhanced SceneManager::applySceneComponentMetadata to hydrate component properties: when a property expects a GameObject, string values are now interpreted as prefab paths and loaded accordingly, supporting prefab references within components.

Asset Path Handling and Bug Fixes:

  • Improved splash screen asset path fallback to handle missing textures more robustly, using the correct vendor asset directory and basename.
  • Fixed scene loading to try both Assets and assets directories for scene files, improving compatibility across platforms.

Other Minor Improvements:

  • Added null initialization for Game::$consoleCursor to prevent uninitialized property issues.
  • Added new constants for tmux environment keys in Game.php.

These changes collectively make prefab usage more reliable, flexible, and maintainable, while improving the safety and predictability of game object cloning and scene loading.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@amasiye amasiye merged commit 047bfb6 into main Mar 15, 2026
0 of 2 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.

1 participant