Introducing DataContainers#156
Open
MiquelBarbara wants to merge 43 commits into
Open
Conversation
…*, Script&, ScriptComponent&) to void (*)(const FieldInfo&, void*, IFieldContainer&). All 11 handler .cpp files updated. Dummy DataContainerScriptDummy/DataContainerComponentDummy classes removed from DataContainer.cpp.
… deserialize, clone, fixReferences). ScriptComponent.cpp methods are now 1-line delegations. DataContainer.cpp uses FieldUtils for all field loops. The same code that was duplicated across 6 methods now lives in one place.
…), serializeScriptFields (60 lines), deserializeScriptFields (80 lines) — replaced by FieldUtils::drawUi/serialize/deserialize calls. ~450 lines of manual switch(field.type) eliminated. The component now uses the same FieldHandler dispatch as ScriptComponent and DataContainer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new type of asset called DataContainers, designed to mimic the behavior of Unity’s ScriptableObjects.
The main goal is to provide a centralized way to modify enemy (and other gameplay) configuration without needing to recreate prefabs, enabling faster iteration during testing and balancing phases.
Changes
New Asset Type: DataContainers
Added a new asset type called
DataContainer.DataContainers allow configuration data to be stored independently from prefabs and scripts.
This enables:
Creating a DataContainer
To create a new DataContainer:
DataContainer.Example:
Using DataContainers in Scripts
Scripts can reference DataContainers using the
ScriptDataContainerRefwrapper.This enables drag-and-drop assignment of configuration assets.
Benefits:
Full decoupling between configuration and logic
Support for inheritance, allowing:
Editor Integration
Once the
.hfile is created, new DataContainers of the available types can be created from the Assets menu (top-left).Added a new editor window:
WindowDataContainerManagerThis window provides centralized, global management of all DataContainers in the project.