class ManagedTypeUtility

Provides various utility methods for reflection-like operations on managed objects.

Public

Methods

staticGetTypeInfo

static SPtr<ManagedTypeInfo> GetTypeInfo(MonoReflectionType *objectType)

Retrieves information about the object's type.

Object must be a primitive type, scene object, component, resource, resource reference type, or a custom type marked with SerializeObject attribute in order for type information to be present. Type information can also be retrieved for arrays, lists or dictionaries of the above types.

staticGetSerializableObjectInfo

static SPtr<ManagedObjectInfo> GetSerializableObjectInfo(MonoReflectionType *objectType)

Retrieves detailed information about a serializable object.

Provided object's type must be marked with a SerializeObject attribute for this information to be available.

staticGetRTTITypeId

static u32 GetRTTITypeId(MonoReflectionType *objectType)

Deduces the RTTI ID of the native object that is wrapped by the provided object type.

Returns ~0u for types that do not wrap native types.

staticCreateSerializableObject

static MonoObject *CreateSerializableObject(const SPtr<ManagedTypeInfoObject> &typeInfo)

Creates a new instance of a serialized object of the provided type.

staticCreateArray

static MonoObject *CreateArray(const SPtr<ManagedTypeInfoArray> &typeInfo, const Vector<u32> &arraySizes)

Creates a new instance of an array of the provided type and size.

Size array must have an element for each rank of the array type.

staticCreateList

static MonoObject *CreateList(const SPtr<ManagedTypeInfoList> &typeInfo, u32 size)

Creates a new instance of a list of the provided type with the provided initial capacity.

staticCreateDictionary

static MonoObject *CreateDictionary(const SPtr<ManagedTypeInfoDictionary> &typeInfo)

Creates a new instance of a dictionary of the provided type.

staticCloneObject

static MonoObject *CloneObject(MonoObject *original)

Clones the specified object.

Non-serializable types and fields are ignored in clone. A deep copy is performed on all serializable elements except for resources or game objects.

original
Non-null reference to the object to clone. Object type must be serializable.

Returns: Deep copy of the original object

staticCreateObjectOfType

static MonoObject *CreateObjectOfType(MonoReflectionType *type)

Creates an uninitialized object of the specified type.

type
Type of the object to create. Must be serializable

Returns: New instance of the specified type, or null if the type is not serializable.