Class MsdfMaterialEditorBase
Extensible material editor for materials that use MSDFs.
[PublicAPI]
public abstract class MsdfMaterialEditorBase : ShaderGUI
- Inheritance
-
ShaderGUIMsdfMaterialEditorBase
- Derived
- Inherited Members
-
ShaderGUI.OnMaterialPreviewGUI(MaterialEditor, Rect, GUIStyle)ShaderGUI.OnMaterialInteractivePreviewGUI(MaterialEditor, Rect, GUIStyle)ShaderGUI.OnMaterialPreviewSettingsGUI(MaterialEditor)ShaderGUI.OnClosed(Material)ShaderGUI.AssignNewShaderToMaterial(Material, Shader, Shader)ShaderGUI.ValidateMaterial(Material)
Examples
By implementing SetupScopes(IDictionary<string, MaterialProperty>), you can create UIs separated into sections, or even extend existing sections if you are basing your material on a provided one.
public class MyAwesomerDecal : DecalMaterialEditor
{
private static readonly GUIContent MyCoolScope = new("Awesome Things");
protected void SetupScopes(IDictionary<string, MaterialProperty> unhandledProperties)
{
base.SetupScopes(unhandledProperties);
if (unhandledProperties.Remove("_AwesomeEffectColor", out var awesomeEffectColor)
{
AddToScope(MyCoolScope, editor =>
{
editor.ShaderProperty(awesomeEffectColor);
});
}
}
}
Fields
AdvancedOptionsScope
Scope containing specialist options, generally things with concern to performance or graphics workflow, rather than strictly visual parameters.
protected static readonly GUIContent AdvancedOptionsScope
Field Value
- GUIContent
- See Also
SurfaceInputsScope
Scope containing general setup like colors, normals, and whatnot.
protected static readonly GUIContent SurfaceInputsScope
Field Value
- GUIContent
- See Also
Methods
AddToScope(GUIContent, ScopeDrawer)
protected void AddToScope(GUIContent scope, MsdfMaterialEditorBase.ScopeDrawer draw)
Parameters
scope
GUIContentdraw
MsdfMaterialEditorBase.ScopeDrawer
- See Also
DrawProperty<T>(MaterialProperty, Func<MaterialProperty, T>, Action<MaterialProperty, T>)
protected void DrawProperty<T>(MaterialProperty property, Func<MaterialProperty, T> draw, Action<MaterialProperty, T> assign)
Parameters
Type Parameters
T
- See Also
OnGUI(MaterialEditor, MaterialProperty[])
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
Parameters
materialEditor
MaterialEditorproperties
MaterialProperty[]
- See Also
SetupScopes(IDictionary<string, MaterialProperty>)
Called during the GUI lifecycle, you can call AddToScope(GUIContent, ScopeDrawer) here to set up your GUI sections.
protected abstract void SetupScopes(IDictionary<string, MaterialProperty> unhandledProperties)
Parameters
unhandledProperties
IDictionary<string, MaterialProperty>Material properties that have not been handled by any drawer yet, indexed by name. Make sure to remove the ones you plan on drawing.
- See Also