https://github.com/dubit/unity-forms
Forms is designed to get Unity user interface forms built quickly.
https://github.com/dubit/unity-forms
Last synced: over 1 year ago
JSON representation
Forms is designed to get Unity user interface forms built quickly.
- Host: GitHub
- URL: https://github.com/dubit/unity-forms
- Owner: dubit
- Created: 2018-05-31T13:12:44.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-06-14T09:03:17.000Z (about 5 years ago)
- Last Synced: 2023-08-03T20:22:29.612Z (almost 3 years ago)
- Language: C#
- Homepage:
- Size: 43.9 KB
- Stars: 10
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# unity-forms
## What is it?
Forms are designed to make UserInterface forms quicker. A form can hold multiple fields with pre-made fields available such as:
* Text Input
* Radio button
* Dropdown
* Checkbox
However you can extend AbstractFormField.cs and make a custom field.
Also included are Validators, validators are components you can add to the field GameObject that determine if the form can be submitted successfully. Validators available are:
* Regex
* FieldMatch
* CheckBox IsOn
* NullOrEmpty
* Text length
With options like clear field on submit and the OnValidationFailed event you can customize the users experience and feedback.
## How to use it.
Create your fields and assign unique id's to each one.
Reference the fields in the form component.
Apply an extra validator components to the fields.
Assign the submit button to the Form component.
```c#
form.OnSubmitForm += HandleFormSubmitted;
private void HandleFormSubmitted(Dictionary fields)
{
var email = fields["email"].GetStringValue();
var password = fields["password"].GetStringValue();
}
```
`OnSubmitForm` will only Invoke if all validators return valid.
## Examples
Examples are included in the Examples folder.
It includes an example login and registration form with form field validation messages.