我有一系列課程:
public class A<T> : ScriptableObject {}
public class B : A<int> { }
public class C : A<float> { }
public class D<T> : A<T> { }
public class E : D<int> { }
我有兩個抽屜:
[CustomPropertyDrawer(typeof(A<>), true)]
public class ADrawer : PropertyDrawer { }
[CustomPropertyDrawer(typeof(D<>), true)]
public class DDrawer : PropertyDrawer { }
問題是 ADrawer 也適用于 E 物件而不是 DDrawer 如果我做
[CustomPropertyDrawer(typeof(E), true)]
public class EDrawer : PropertyDrawer { }
有什么建議嗎?
uj5u.com熱心網友回復:
好的,解決方案是:將兩個 Drawer 放在不同的命名空間中。例子:
namespace FakeNamespace.Drawers
{
[CustomPropertyDrawer(typeof(A<>), true)]
public class ADrawer : PropertyDrawer { }
}
namespace FakeNamespace.Drawers.Others
{
[CustomPropertyDrawer(typeof(D<>), true)]
public class DDrawer : PropertyDrawer { }
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/508683.html
上一篇:無法在Unity3D中呼叫動態庫
