Reflection utility functions. More...
Static Public Member Functions | |
static MemberInfo[] | GetEditableMembers (Type type, bool includeInherited=true) |
Gets all fields and properties tagged with ksEditable or ksUnityTag on a type. More... | |
static MemberInfo[] | GetCloneableMembers (Type type) |
Gets all fields and properties tagged with ksEditable, ksUnityTagAttribute, or ksCloneable on a type. More... | |
static MemberInfo[] | GetMembersWithAttribute (Type type, bool includeInherited, params Type[] attributes) |
Gets all fields and properties tagged with any of the given attributes on a type. More... | |
static bool | HasAnyAttributes (MemberInfo member, params Type[] attributes) |
Checks if a member has any of the given attributes. More... | |
static Type | GetType (MemberInfo memberInfo) |
Gets the type of a field or property. More... | |
static object | GetValue (object script, MemberInfo memberInfo) |
Gets the value of a field or property. More... | |
static void | SetValue (object script, MemberInfo memberInfo, object value) |
Sets the value of a field or property. More... | |
static T | Clone< T > (T script) |
Creates a copy of a script with the value of all members tagged with ksEditable or ksCloneable copied. More... | |
Reflection utility functions.
|
static |
Creates a copy of a script with the value of all members tagged with ksEditable or ksCloneable copied.
Arrays, lists, and dictionaries are cloned. Other object references will reference the same object.
T | Script to clone. |
script | Cloned script. |
T | : | class |
|
static |
Gets all fields and properties tagged with ksEditable, ksUnityTagAttribute, or ksCloneable on a type.
type | Type to get cloneable fields and properties from. |
|
static |
Gets all fields and properties tagged with ksEditable or ksUnityTag on a type.
type | Type to get editable fields and properties from. |
includeInherited | If true, will include editable members from base classes. |
|
static |
Gets all fields and properties tagged with any of the given attributes on a type.
type | Type to get tagged fields and properties from. |
includeInherited | If true, will include tagged members from base classes. |
attributes | Attributes to check for. Members are returned if they have at least one of this attributes. |
|
static |
Gets the type of a field or property.
memberInfo | MemberInfo to get type from. |
|
static |
Gets the value of a field or property.
script | Script containing the field or property. |
memberInfo | MemberInfo for field or property. |
|
static |
Checks if a member has any of the given attributes.
member | Member to check for attributes. |
attributes | Attributes to check for. |
|
static |
Sets the value of a field or property.
script | Script containing the field or property. |
memberInfo | MemberInfo for the field or property. |
value | Value to set. |