class ManagedResource

Inherits: Resource

Resource that internally wraps a managed resource object that can be of user-defined type.

Public

Constructors

ManagedResource

ManagedResource()

Methods

GetManagedInstance

MonoObject *GetManagedInstance() const

Returns the internal managed resource object.

Backup

Serializes the internal managed resource.

Returns: An object containing the serialized resource. You can provide this to restore() method to re-create the original resource.

Restore

void Restore(const ResourceBackupData &data)

Restores a resource from previously serialized data.

data
Serialized managed resource data that will be used for initializing the new managed instance.

staticCreateUninitialized

static HManagedResource CreateUninitialized()

Creates an empty managed resource without calling Initialize(), as a resource handle.

staticCreateUninitializedAsShared

static SPtr<ManagedResource> CreateUninitializedAsShared()

Creates an empty managed resource without calling Initialize(), as a shared pointer.

staticGetRttiStatic

static RTTIType *GetRttiStatic()

GetRtti

RTTIType *GetRtti() const

Returns an interface you can use to access class' Run Time Type Information.

Private

Methods

Initialize

void Initialize() override

Initializes all the internal data of this object.

Must be called right after construction for new objects, or after deserialization for deserialized objects. If requested, render proxy is created and queued for initialization on the render thread.

SetupScriptBindings

void SetupScriptBindings(const SPtr<ManagedObjectInfo> &objectInformation)

Sets up script bindings between native and managed class.

Must be called after creating the script object wrapper, or after assembly is reloaded.

CreateScriptObject

MonoObject *CreateScriptObject(SPtr<ManagedObjectInfo> &outObjectInformation) const

Creates the script object of the correct type.

outObjectInformation
Information about the resource type. Can be null in case the type does no longer exist.

Returns: Creates script object of the correct resource type, or if type cannot be found, script object of missing type.

Fields

mMissingType

bool mMissingType

mSerializedObjectData

SPtr<ManagedSerializableObject> mSerializedObjectData

mObjectInformation

SPtr<ManagedObjectInfo> mObjectInformation