Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON Schema to UI generator improvements #111

Open
cs-util opened this issue Oct 11, 2023 · 0 comments
Open

JSON Schema to UI generator improvements #111

cs-util opened this issue Oct 11, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@cs-util
Copy link
Collaborator

cs-util commented Oct 11, 2023

There are multiple open todos in the logic that takes a json schema and generates a UI from it:

  1. It would make sense to introduce an annotation that defines the order of the input UIs for the fields of the class. The order of the fields in the class does not automatically define this order in the UI so a [UiOrder(“Section X”, 1)] where both a grouping of UI elements into sections and a sorting of these elements can be set would be quite useful.
  2. The GenerateViewFrom(..) logic needs to be extended to use the values of the fields as input to set the default values of the UI elements correctly. Eg if a field in the class is a bool keepUserLoggedIn = false flag the UI generation should take that default “false” value and generate the UI accordingly that the checkbox is false by default.
  3. The default slider Unity UI element ignores the min and max values defined in the [Range(min,max)]
  4. It might be possible to delete most of the annotation classes (e.g. Range) and instead switch the logic to only rely on the classes with the same names in the System.ComponentModel.DataAnnotations namespace . Depends on if Unity also included these annotation classes, easiest way is to test with the Range attribute by deleting the manually written class from cscore and switch to the official one https://learn.microsoft.com/de-de/dotnet/api/system.componentmodel.dataannotations.rangeattribute

There are probably many more smaller improvements that would make sense to make the JSON schema to UI generation system production ready. Easiest way to discover these is probably to build more demo scenes in Unity that resemble realistic usage scenarios for such UIs. E.g.:

  1. Generating a settings UI just from the concrete instance of the settings class that is used by the application during runtime.
  2. Generating debug UIs to be able to look into instances of classes during runtime to have an easier to consume visualization of the state of the application compared to a json dump in a log console
  3. Demonstrating how a model class of eg a Login UI (where email and password are validated via regex etc) can be used to be able in Unity editor time to generate a first draft of the Login UI and then save that as a prefab and further modify it to fit the developers preferences. Demonstrating this ability is important to make the system really helpful, the UI generation is only the first step in the workflow of the developer and does not block them from modifying the generated UI prefab in any way they want afterwards.
@cs-util cs-util added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Oct 11, 2023
@cs-util cs-util added this to To do in cscore Features via automation Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
Development

No branches or pull requests

1 participant