mirror of
https://github.com/maxartz15/Validator.git
synced 2024-09-07 22:08:05 +02:00
Unity project validator framework.
Documentation~ | ||
Editor | ||
Runtime | ||
.gitignore | ||
CHANGELOG.md | ||
CHANGELOG.md.meta | ||
Editor.meta | ||
LICENSE.md | ||
LICENSE.md.meta | ||
package.json | ||
package.json.meta | ||
README.md | ||
README.md.meta | ||
Runtime.meta | ||
THIRD PARTY NOTICES.md | ||
THIRD PARTY NOTICES.md.meta |
Validator
Unity project validator framework.
Getting Started
Add a custom validate check using the IValidatable
interface:
using Validator;
public class MyBehaviour : MonoBehaviour, IValidatable
{
[SerializeField] private float startHealth = 10; // If someone was to put it to low <= 0, it would be invalid.
#if UNITY_EDITOR
public void Validate(Report report)
{
// Check if health is valid.
if(startHealth <= 0)
{
// If not, log it.
report.Log(this, WarningType.Warning, ReportCategories.Design, $"{nameof(startHealth)} is to low", $"Make value > 0");
}
}
#endif
}
Add a validate check using [Required]
attribute:
[SerializeField, Required] private GameObject playerPrefab = null; // If someone forgets to assign it, it would be invalid.
Open Validator Window:
Window -> General -> Validator
Run the validator:
Click the 'run/play' button and wait for the report to be generated.
Install
LICENSE
Overall package is licensed under MIT, unless otherwise noted in the 3rd party licenses file and/or source code.