Rule Presets

When you create validation rules for your project, especially if that rule has a critical level (SV_ValidationState.Error), if somebody sees that some components had an issue you described in that rule - it should be fixed immediately. Since it's critical and most likely will cause an issue in production. 

But if you have a pretty big team and already have a lot of validation rules in the project. Your team may come to the point when designed open's scene and sees a lot of tech rules. But since this isn't his eras of expertise those will be ignored. The same would work for developers an "art" type issues. This will lead to a very bad habit to lead critical rules unresolved, and will also keep people overwhelmed with unnecessary information.

That's why we have presented. You may specify rule preset like "Dev" or "Art" and then every persona it team can decide if we want to only see "Art" or "Dev" issues, or probably he still wants to see all of it.

Here is how simple rule class looks like:

using SA.Productivity.SceneValidator
...

public class SV_SpriteRendererCompatibilityRule : SV_SimplifiedRule<SpriteRenderer>
{
    public override string GetErrorMessage(SpriteRenderer component, SV_ValidationState state) {
        return "SpriteRenderer can't be located on the same Gameobject with an Image component";
    }

    public override SV_ValidationState OnValidate(SpriteRenderer component) {
        var go = component.gameObject;
        if(go.GetComponent<Image>() != null) {
            return SV_ValidationState.Error;
        } else {
            return SV_ValidationState.Ok;
        }
    }
}

If you want to define "Dev" preset for it, just override Preset property.

public override string Preset {
    get {
        return "Dev";
    }
}

So the full rule would look like this:

using SA.Productivity.SceneValidator
...

public class SV_SpriteRendererCompatibilityRule : SV_SimplifiedRule<SpriteRenderer>
{
    public override string GetErrorMessage(SpriteRenderer component, SV_ValidationState state) {
        return "SpriteRenderer can't be located on the same Gameobject with an Image component";
    }

    public override SV_ValidationState OnValidate(SpriteRenderer component) {
        var go = component.gameObject;
        if(go.GetComponent<Image>() != null) {
            return SV_ValidationState.Error;
        } else {
            return SV_ValidationState.Ok;
        }
    }

    public override string Preset {
	    get {
	        return "Dev";
	    }
	}
}

Note: Rules that do not have overridden Preset will be shown for every preset.

Presets UI

If at least one of your rules has an overridden preset. The Report settings will have a Preset foldout, where you can specify the preset you want to be used.

Also, if you will select for example "Dev" present in a drop-down above, it will also be reflected inside the scene view widget.