Search Unity

Custom Editors for Shaders?

Discussion in 'Scripting' started by Studio_Akiba, Oct 4, 2015.

  1. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    After developing a series of very large shaders, I feel I am in need of a custom inspector for them as they take up far too much room.
    I like the look of the Standard Shader editor with the small texture boxes, but have no idea where to start, not very many people do this to shaders but I feel like I should probably have them.

    Does anyone know how to write custom inspectors for shaders?
     
  2. Roland1234

    Roland1234

    Joined:
    Nov 21, 2012
    Posts:
    190
    You can define a custom editor for a shader by deriving from ShaderGUI, and adding
    Code (csharp):
    1.  
    2. Shader "ShaderName"
    3. {
    4.     [...]
    5.     CustomEditor "NameOfCustomGUI"
    6. }
    7.  
    to the shader itself.

    I have little experience with this myself, but it looks like you can use standard EditorGUI calls in this.
    Check Unity's built-in shaders for examples.
    Cheers!