Simple Shader Inspectors by VRLabs - 1

Shaders & EffectsGames & Projects

Unity library to make shader inspector creation easier

Unknown VersionOtherUpdated 27 days agoCreated on July 6th, 2020
Go to source
Simple Shader Inspectors

Simple Shader Inspectors

Unity Editor library with the objective to make medium to complex shader inspectors easier to create and manage.




How to use

To use the library you need to create a shader inspector by substituting ShaderGUI with SimpleShaderInspector.

Here is a quick example of how a simplistic shader inspector code looks.

using UnityEngine;
using UnityEngine;
using VRLabs.SimpleShaderInspectors;

public class TestShaderInspector : SimpleShaderInspector
{
    private PropertyControl _floatControl;
    private LabelControl _labelControl;

    public override void Start()
    {
        _floatControl = this.AddPropertyControl("_FloatProperty").Alias("MyFloatProperty");
        _labelControl = this.AddLabelControl("MyLabel");
    }

    public override void StartChecks(MaterialEditor materialEditor)
    {
        _labelControl.SetEnabled(_floatControl.Property.FloatValue > 1);
    }

    public override void CheckChanges(MaterialEditor materialEditor)
    {
        if(_floatControl.HasPropertyUpdated)
        {
            _labelControl.SetEnabled(_floatControl.Property.FloatValue > 1);
        }
    }
}

The above inspector has 2 controls, with the control displaying a label being displayed only when the material property _FloatProperty float value is above 1. The full guide that explains how all of this works can be found on the official Documentation.

We do also provide some more examples available to download in Releases.

Current state

Right now Simple Shader Inspectors is in a functional beta state, what does it mean? It means that it is a fully functional library that, if it satisfies your needs, can be used outside of pure testing enviroments, but it is not feature complete and it will for sure have multiple breaking changes before getting out of the beta state.

License

Simple Shader Inspectors is available as-is under MIT. For more information see LICENSE.

Downloads

There are 3 packages available in Releases:

  • Simple Shader Inspector: base library for the end user.
  • Simple Shader Inspector dev: development vesion for shader creators, contains some extra tools compared to the base library.
  • Example inspectors: good place to start looking on how the library works, requires one of the 2 packages above in order to work.

You can also download the repository itself, but unless you’re looking into contributing in the project it is highly discouraged since it will very likely not end up in the right folder, possibly ending up causing problems later down the road.

Contributors

You want to help improve the library by adding more controls and/or fixing existing bugs? Feel free to contribute by sending a pr! We are always looking for improvements to the library!

Made with contributors-img.

Showcase

These Shaders are using Simple Shader Inspectors for their editors, check them out!

Made an awesome shader using Simple Shader Inspector and want to show it off? Join our Discord and show it to us! If we like it we may add it to this list!

Show all projects by VRLabs