我正在 Unity 5.6 中制作基于插件的 C# 应用程序,其中有时可能会安装一些插件,有时可能不会。
在我的插件Plugin1
中,我有一个组件Plugin1.Component1
。在同一个项目中,我为它实现了一个自定义编辑器,Plugin1.Component1Editor
称为[CustomEditor(typeof(Plugin1.Component1))]
. Plugin1
安装后,它Component1
可用,并使用自定义编辑器呈现。
我的插件Plugin2
依赖于Plugin1
. 根据其组件中的设置Plugin2.Component2
,它想更改Plugin1.Component1
.
我在 中实现了一个新的自定义编辑器,Plugin2
称为. 它继承自,而不是继承自,因为后者会导致在 中找不到序列化属性的问题。Plugin2.Component1Editor
[CustomEditor(typeof(Plugin1.Component1))]
UnityEditor.Editor
Plugin1.Component1Editor
Plugin1.Component1Editor
Plugin2.Component1Editor
在编译时不会冲突Plugin1.Component1Editor
,因为它有自己的命名空间。但是 Unity 检查器中实际发生了什么?
我测试它时的行为是所需的行为:Plugin2.Component1Editor
呈现检查器,除非Plugin2
未安装。但为什么?我不想相信它会继续这样做,除非我知道为什么。
谢谢!
编辑:我错了,它没有渲染Plugin2.Component1Editor
,它是默认的 Unity 编辑器运行。我的自定义编辑器都没有使用。如何指定要使用哪一个?