1
0
mirror of https://github.com/maxartz15/Validator.git synced 2024-11-21 19:55:34 +01:00
Unity project validator framework.
Go to file
2022-05-03 21:11:12 +02:00
Documentation~ Update README.md 2022-01-01 20:33:46 +01:00
Editor Fix attribute 2022-05-03 21:11:12 +02:00
Runtime Required Attribute Validator 2021-12-29 23:46:52 +01:00
.gitignore Initial commit 2021-12-26 02:15:37 +01:00
CHANGELOG.md Fix attribute 2022-05-03 21:11:12 +02:00
CHANGELOG.md.meta Base validator 2021-12-27 00:52:50 +01:00
Editor.meta Base validator 2021-12-27 00:52:50 +01:00
LICENSE.md Base validator 2021-12-27 00:52:50 +01:00
LICENSE.md.meta Base validator 2021-12-27 00:52:50 +01:00
package.json Fix attribute 2022-05-03 21:11:12 +02:00
package.json.meta Base validator 2021-12-27 00:52:50 +01:00
README.md Update README.md 2022-01-02 15:21:39 +01:00
README.md.meta Base validator 2021-12-27 00:52:50 +01:00
Runtime.meta Base validator 2021-12-27 00:52:50 +01:00
THIRD PARTY NOTICES.md Initial commit 2021-12-26 02:15:37 +01:00
THIRD PARTY NOTICES.md.meta Base validator 2021-12-27 00:52:50 +01:00

Validator

ValidatorWindow

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

Installing from a Git URL

LICENSE

Overall package is licensed under MIT, unless otherwise noted in the 3rd party licenses file and/or source code.