CustomInspector that targets all Renderer subclasses?
Hi
I cant seem to implement a Custom Inspector that would trigger on any/all classes that extend UnityEndine.Renderer. I can however implement multiple CustomEditors for each of the subclasses where each triggers for each of the subclasses correctly.
Some Code:
1) This doesn't seem to run at all (when selecting for ex. GameObject with a MeshRenderer in hierarchy):
[CustomEditor(typeof(Renderer), true)] // editorForChildClasses = true
public class RendererCustomInspector : Editor
{
public override void OnInspectorGUI()
{
Debug.Log("got renderer: "+target); // never runs
}
}
2) This works of for MeshRenderer:
[CustomEditor(typeof(MeshRenderer))]
public class RendererCustomInspector : Editor
{
public override void OnInspectorGUI()
{
Debug.Log("got renderer: "+target); // runs when selecting GO with a MeshRenderer
}
}
How to create generic CustomEditor that will catch selection of GO that has MeshRenderer or TrailRenderer or SpriteRenderer or (anything that subclasses Renderer)?
Your answer
Follow this Question
Related Questions
Custom Editor List with child classes 1 Answer
Custom Inspector Script Resetting Information 0 Answers
Problem with EditorGUILayout.ObjectField 1 Answer
Handle multiple separate scenes on same project 0 Answers
My editor is very slow 0 Answers