PersistentCustomFieldAttribute Class |
Namespace: KSPDev.ConfigUtils
[AttributeUsageAttribute(AttributeTargets.Field)] public sealed class PersistentCustomFieldAttribute : BasePersistentFieldAttribute
The PersistentCustomFieldAttribute type exposes the following members.
Name | Description | |
---|---|---|
![]() | PersistentCustomFieldAttribute | Creates attribute for persistent field with custom type protos. |
To provide own type proto for (de)serializing the field:
class CustomType { [PersistentCustomField("my/custom/type", typeProto: typeof(MyTypeProto))] public MyType field1; }
If your custom type filed is a collection, you need to provide a collection proto handler. It can be one of the existing protos (e.g. GenericCollectionTypeProto or a custom one. Keep in mind that the collection fields must be initialized, or else they won't be handled.
class CustomTypes { [PersistentCustomField("my/custom/type", collectionProto: typeof(GenericCollectionTypeProto))] public List<string> field1 = new List<string>(); }