Version: 
Show / Hide Table of Contents

Class FieldInstance

A FieldInstance is a class that wraps a FieldInfo and a reference. It can be seen as the representation on a field on one particular object instance. This enables an easy serialization / deserialization mechanism through dictionnaries. Dictionnaries are great as they allow to store multiple levels of data and structures such as structs, classes, arrays, or base types. Unity is bad at serializing multiple levels of data and doesn't handles polymorphism. Dictionnaries also fix thoses issues.

Inheritance
System.Object
FieldInstance
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: PiXYZ.Tools
Assembly: cs.temp.dll.dll
Syntax
public sealed class FieldInstance

Constructors

FieldInstance(FieldInfo, Object)

Declaration
public FieldInstance(FieldInfo fieldInfo, object reference)
Parameters
Type Name Description
FieldInfo fieldInfo
System.Object reference

FieldInstance(FieldInfo, Object, MethodInfo, MethodInfo)

Declaration
public FieldInstance(FieldInfo fieldInfo, object reference, MethodInfo visibilityCheck, MethodInfo enablingCheck)
Parameters
Type Name Description
FieldInfo fieldInfo
System.Object reference
MethodInfo visibilityCheck
MethodInfo enablingCheck

FieldInstance(FieldInfo, Object, String, String)

Declaration
public FieldInstance(FieldInfo fieldInfo, object reference, string visibilityCheck = null, string enablingCheck = null)
Parameters
Type Name Description
FieldInfo fieldInfo
System.Object reference
System.String visibilityCheck
System.String enablingCheck

Fields

enablingCheck

Declaration
public readonly MethodInfo enablingCheck
Field Value
Type Description
MethodInfo

fieldInfo

Declaration
public readonly FieldInfo fieldInfo
Field Value
Type Description
FieldInfo

reference

Declaration
public readonly object reference
Field Value
Type Description
System.Object

visibilityCheck

Declaration
public readonly MethodInfo visibilityCheck
Field Value
Type Description
MethodInfo

Properties

name

Returns the field name

Declaration
public string name { get; }
Property Value
Type Description
System.String

type

Returns the field type

Declaration
public Type type { get; }
Property Value
Type Description
System.Type

value

Returns the instance value

Declaration
public object value { get; }
Property Value
Type Description
System.Object

Methods

deserializeData(Dictionary<String, String>)

Unloads the data of the given dictionnary into the object field instance

Declaration
public void deserializeData(Dictionary<string, string> pairs)
Parameters
Type Name Description
System.Collections.Generic.Dictionary<System.String, System.String> pairs

serializeData(ref Dictionary<String, String>)

Fills the referenced dictionnary with serialized data (recursively if the type is complex)

Declaration
public void serializeData(ref Dictionary<string, string> pairs)
Parameters
Type Name Description
System.Collections.Generic.Dictionary<System.String, System.String> pairs

set(Object)

Sets the instance value

Declaration
public void set(object value)
Parameters
Type Name Description
System.Object value
Back to top PiXYZ Plugin for Unity 2019.1