The package streamlines data synchronization between Scriptable Objects and CSVs. It automatically packages the data into Google FlatBuffers for runtime use for fast loading and reduced memory footprint. A data validation workflow is provided to enforce and maintain the integrity of data and its interrelationships.
Benefits
- Allows bulk modifications through CSVs or fine-turning of entities through the Scriptable Object inspector.
- Runtime advantages of Google FlatBuffers without imposing the complexities associated with the conventional FlatBuffer workflow.
- No overhead of runtime deserializing of Scriptable Objects.
- Compressed de-duplicated data in memory.
- Auto data validation of generated runtime data & during inspector edit time.
Define a Scriptable Object or struct by creating an interface.
public interface ICurrencyInfo : IBaseInfo
{
bool IsPremiumCurrency { get; }
LocalizedString DisplayName { get; }
LocalizedString Description { get; }
short StartingAmount { get; }
AssetReferenceSprite Icon { get; }
}
Create & modify Scriptable Objects in editor.
Or modify in bulk using the sync'd CSV(s).
Identifier | IsPremiumCurrency | DisplayName | Description | StartingAmount | Icon |
---|---|---|---|---|---|
string | bool | LocalizedString | LocalizedString | short | AssetReferenceSprite |
Coin | 0 | Coin | Common currency | 100 | 4c36500ce4684478781316054b5e16d6-coin |
Gems | 1 | Gem | Shiny! | 50 | - |
Lumber | 0 | Lumber | Chop chop chop | 10 | - |
Stone | 0 | Stone | I'm a Stone | 20 | - |
A Parameter.bytes
asset is automatically generated for runtime use and can be loaded through Resources
or as an Addressable
asset.
Streamlined API for inline data retrieval.
# get a specific currency item
ICurrencyInfo coinInfo = Params.Get<ICurrencyInfo>("Coin");
if (coinInfo != null)
{
bool isPremiumCurrency = coinInfo.IsPremiumCurrency;
// ...
}
# iterate over all CurrencyInfos
IEnumerable<ICurrencyInfo> currencyInfos = Params.Get<ICurrencyInfo>();
foreach (ICurrencyInfo info in currencyInfos)
{
Debug.Log($"{info.Name}: {info.StartingAmount}")
}
Validation window to see all failed checks.
Inspector support for on-the-fly validation.
Quickly add validation with attributes.
public interface ICurrencyInfo : IBaseInfo
{
bool IsPremiumCurrency { get; }
[AssertStringNotEmpty]
LocalizedString DisplayName { get; }
[AssertStringNotEmpty]
LocalizedString Description { get; }
[AssertGreaterOrEqual(0)]
short StartingAmount { get; }
AssetReferenceSprite Icon { get; }
}
Support to implement custom validations as required.
protected override void ValidateInfo(IParameterManager parameterManager, ICurrencyInfo info)
{
if (info.IsPremiumCurrency && string.IsNullOrEmpty(info.PremiumCurrencyIconSprite.AssetGUID))
Error(nameof(ICurrencyInfo.PremiumCurrencyIconSprite), "required for premium currency");
}
- One Time Setup: Guide for initial project configuration and code bootstrapping.
- Defining Data Types: Instructions to define and adjust data types.
- Interfaces & Enums: Specifics about defining interfaces & enums.
- Content Workflow: Process for creating and modifying data using CSVs or Scriptable Objects.
- Generated Asset: Details about the asset that holds the auto generated parameter data.
- Querying Data: Techniques and guidelines for querying data at runtime.
- Data Validation: Establish rules and criteria for ensuring data integrity.
- Validation Attributes: All valid attributes for validation use.
- Troubleshooting
This README follows the structure of Make a README.