Unity 自定义编辑器时让子类继承父类的Inspector显示效果

官方文档里的 CustomEditor函数

namespace UnityEditor
{
    
    
    //
    // 摘要:
    //     Tells an Editor class which run-time type it's an editor for.
    public class CustomEditor : Attribute
    {
    
    
        //
        // 摘要:
        //     Defines which object type the custom editor class can edit.
        //
        // 参数:
        //   inspectedType:
        //     Type that this editor can edit.
        //
        //   editorForChildClasses:
        //     If true, child classes of inspectedType will also show this editor. Defaults
        //     to false.
        public CustomEditor(Type inspectedType);
        //
        // 摘要:
        //     Defines which object type the custom editor class can edit.
        //
        // 参数:
        //   inspectedType:
        //     Type that this editor can edit.
        //
        //   editorForChildClasses:
        //     If true, child classes of inspectedType will also show this editor. Defaults
        //     to false.
        public CustomEditor(Type inspectedType, bool editorForChildClasses);

        //
        // 摘要:
        //     If true, match this editor only if all non-fallback editors do not match. Defaults
        //     to false.
        public bool isFallback {
    
     get; set; }
    }
}

在这里插入图片描述
CustomEditor有两个,调用第二个函数时第二个值为true就可以啦

猜你喜欢

转载自blog.csdn.net/weixin_45023328/article/details/125597263