Skip to main content

Editor Injection

Editor injection adds small pieces of UI around the KIBAMaterialGUI inspector.

Use it when you want to keep KIBAMaterialGUI's normal property rendering but add shader-specific tools, shortcuts, diagnostics, or menu items.

What It Is For​

Editor injection is good for:

  • buttons above or below a group,
  • shader-specific toolbar actions,
  • quick presets beside a group header,
  • right-click group menu items,
  • custom diagnostics,
  • filter shortcuts,
  • small helper blocks before or after a property.

Use Custom Renderers instead when the field itself needs a different editor.

Choose The Right Extension Point​

GoalUse
Draw free-form IMGUI before or after existing UIIShaderEditor with [ShaderEditorInjection]
Add, hide, or lock toolbar itemsIToolbarContributor
Add compact buttons to group headersIMaterialGUIGroupActionContributor
Add right-click group menu itemsIGroupMenuContributor
Add warnings/errors/info messagesIMaterialGUIDiagnosticProvider
Add filter shortcuts or custom filter controlsIMaterialGUIFilterProvider

Learning Path​

  1. Choosing An Extension Point
  2. Hook Injection
  3. Toolbar Contributions
  4. Group Actions And Menus
  5. Diagnostics And Filters

Minimal Hook Example​

using KIBA_.KIBAMaterialGUI.Editor.Extensibility;
using UnityEditor;

[ShaderEditorInjection(
HookPoint.AfterToolbar,
Order = 0,
ShaderNameEquals = new[] { "KIBA_/Examples/MyShader" })]
public sealed class MyShaderNotice : IShaderEditor
{
public void OnGUI(InjectionArgs args)
{
EditorGUILayout.HelpBox("This shader has project-specific helper tools.", MessageType.Info);
}
}

This draws an info box after the KIBAMaterialGUI toolbar for one shader.