문제가 있습니다.C# 비공개로 투입 할 수 없음
유니티에서는 사적인 분야에 대해 생각하고 싶습니다. 하지만 난 항상 fieldinfo null이됩니다. 내가 도대체 뭘 잘못하고있는 겁니까?
public abstract class _SerializableType
{
[SerializeField] private string name;
}
// because I am using a CustomPropertyDrawer for all inherited from _SerializeType
public class SerializableType<T> : _SerializableType { }
public class SerializableType : _SerializableType { }
[Serializable] public class CTech : SerializableType<_CouplingTechnology> { }
이 방법을 사용하면 실제로 작동해야합니다.
// type is CTech
// propertyPath in that case is "name"
FieldInfo info = type.GetField(propertyPath, BindingFlags.Instance
| BindingFlags.Public | BindingFlags.NonPublic);
내가 뭘 잘못하고 있니?
고유 한 CustomInspector가있는 관리되는 라이브러리에서이 메서드를 호출하려고합니다. 그래서 그것은 모든 분야에 반영하고 그것을 어떻게 표시해야 하는지를 보여줍니다. AppDomain은 완전히 신뢰할 수 있습니다. 나는 그 밖에 무엇이 중요 할 수 있는지 모른다 ...
변수'type'은'typeof (_SerializableType)'입니까? –
@AntonKomyshan이 말한 것에 덧붙여, 변수'propertyPath'는 문자열 "name"이어야합니다? –
@AntonKomyshan 옙 타입이 _SerializeType입니다 (seriliazedObject의 Iterator를 통해 얻었습니다) 더 복잡하다고 말했습니다. SteveDanner보다 더 넣었습니다 ... –