jeffcampbellmakesgames / Genesis

A general purpose code generator library for Unity
MIT License
74 stars 8 forks source link

[v2 Genesis] Implement configuration generation, import #8

Closed jeffcampbellmakesgames closed 3 years ago

jeffcampbellmakesgames commented 3 years ago

Is your feature request related to a problem? Please describe. There is a need to be able to supply Genesis with various configuration arguments for both the app itself as well as any plugins it may be running.

Describe the solution you'd like Command-line arguments are sufficient for the Genesis app, but for it's plugins these should rely on a mechanism that does not require modifying the CLI app to introduce new args. In short, there should be a configuration abstraction layer that enables a plugin to get it's config values and which is populated from one or more files. Currently this is in the form of KeyValuePairs in a ScriptableObject so it's likely this could be in a similar format, but available as a file or as an aggregated string format to be passed to the CLI app.

As a standalone app, one thought is that it might be helpful to have a `--create-config argument which calls on each plugin assembly to generate all config data unique to it and populate a local config file with a default or custom name so that a developer can easily see all of the config arguments with default values that are available.

In addition, in order to provide a first-class experience inside Unity, it should also be possible to interact and manipulate with a config file via the inspector (likely as an SO of some sort) rather than hand-manipulate a config file.

JSON seems like a pretty likely format given that there is native support in Unity to serialize to it without requiring any third-party plugins and its one of, if not the most common file format Unity developers interact with.

Describe alternatives you've considered YAML is another potential option, but in order to not include a YAML library directly with Unity I'd likely recommend creating a package version of YamlDotNet or the like so it can be referenced as a dependency for Unity.

jeffcampbellmakesgames commented 3 years ago

Example configs of this in the project currently include:

It's likely that the existing config setup in Unity is reusable for this purpose, but with an export ability that outputs it to a JSON format that the CLI can import.

jeffcampbellmakesgames commented 3 years ago

This has been accomplished in feat/v2.