Class ManagedBinaryModule
The C#-only scripting assembly container that holds the native types information and supports interop with managed runtime.
Inheritance
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Scripting/BinaryModule.h
Syntax
public class ManagedBinaryModule : public BinaryModule
Constructors
~ManagedBinaryModule()
ManagedBinaryModule(const StringAnsiView& name)
Initializes a new instance of the ManagedBinaryModule class.
Declaration
public ManagedBinaryModule(const StringAnsiView& name)
Parameters
StringAnsiView
name
The module name. |
ManagedBinaryModule(MAssembly* assembly)
Initializes a new instance of the ManagedBinaryModule class.
Declaration
public ManagedBinaryModule(MAssembly* assembly)
Parameters
MAssembly
assembly
The managed assembly. Object will be deleted within the scripting assembly. |
Fields
Assembly
ClassToTypeIndex
The scripting types cache that maps the managed class to the scripting type index. Build after assembly is loaded and scripting types get the managed classes information.
Declaration
public Dictionary<MClass* , int32, HeapAllocation> ClassToTypeIndex
Field Value
Dictionary<MClass , int32, HeapAllocation>
|
Methods
Destroy(bool isReloading)
Unloads the module (native library and C# assembly and any other scripting data). Unregisters the module.
Declaration
public virtual void Destroy(bool isReloading) override
Parameters
bool
isReloading
If true module is during reloading and should force release the runtime data. Used for C# assembly to clean up it's runtime data in Mono (or other scripting runtime). |
Overrides
FindField(const ScriptingTypeHandle& typeHandle, const StringAnsiView& name)
Tries to find a field in a given scripting type by the field name.
Declaration
public virtual void* FindField(const ScriptingTypeHandle& typeHandle, const StringAnsiView& name) override
Parameters
ScriptingTypeHandle
typeHandle
The type to find field inside it. |
StringAnsiView
name
The field name. |
Returns
void
The field or null if failed to get it. |
Overrides
FindMethod(const ScriptingTypeHandle& typeHandle, const ScriptingTypeMethodSignature& signature)
Tries to find a method in a given scripting type by the method signature.
Declaration
public virtual void* FindMethod(const ScriptingTypeHandle& typeHandle, const ScriptingTypeMethodSignature& signature) override
Parameters
ScriptingTypeHandle
typeHandle
The type to find method inside it. |
ScriptingTypeMethodSignature
signature
The method signature. |
Returns
void
The method or null if failed to get it. |
Overrides
FindMethod(const ScriptingTypeHandle& typeHandle, const StringAnsiView& name, int32 numParams = 0)
Tries to find a method in a given scripting type by the method name and parameters count.
If the type contains more than one method of the given name and parameters count the returned value can be non-deterministic (one of the matching methods).
Declaration
public virtual void* FindMethod(const ScriptingTypeHandle& typeHandle, const StringAnsiView& name, int32 numParams = 0) override
Parameters
ScriptingTypeHandle
typeHandle
The type to find method inside it. |
StringAnsiView
name
The method name. |
int32
numParams
The method parameters count. |
Returns
void
The method or null if failed to get it. |
Overrides
FindMethod(MClass* mclass, const ScriptingTypeMethodSignature& signature)
Declaration
public static MMethod* FindMethod(MClass* mclass, const ScriptingTypeMethodSignature& signature)
Parameters
MClass
mclass
|
ScriptingTypeMethodSignature
signature
|
Returns
MMethod
|
FindModule(const MClass* klass)
Declaration
public static ManagedBinaryModule* FindModule(const MClass* klass)
Parameters
MClass
klass
|
Returns
ManagedBinaryModule
|
FindType(const MClass* klass)
Declaration
public static ScriptingTypeHandle FindType(const MClass* klass)
Parameters
MClass
klass
|
Returns
ScriptingTypeHandle
|
GetFields(const ScriptingTypeHandle& typeHandle, Array<void* >& fields)
Gets handles of all fields in a given scripting type.
Declaration
public virtual void GetFields(const ScriptingTypeHandle& typeHandle, Array<void* >& fields) override
Parameters
ScriptingTypeHandle
typeHandle
The type to find fields inside it. |
Array<void >
fields
The output list of field pointers. |
Overrides
GetFieldSignature(void* field, ScriptingTypeFieldSignature& fieldSignature)
Gets the scripting type field signature metadata.
Declaration
public virtual void GetFieldSignature(void* field, ScriptingTypeFieldSignature& fieldSignature) override
Parameters
void
field
The field. |
ScriptingTypeFieldSignature
fieldSignature
The output field signature info. |
Overrides
GetFieldValue(void* field, const Variant& instance, Variant& result)
Gets the value of a given scripting field.
Declaration
public virtual bool GetFieldValue(void* field, const Variant& instance, Variant& result) override
Parameters
void
field
The field. |
Variant
instance
The object instance to get its member field. Unused for static fields. |
Variant
result
The output field value. |
Returns
bool
True if failed, otherwise false. |
Overrides
GetMethods(const ScriptingTypeHandle& typeHandle, Array<void* >& methods)
Gets handles of all method in a given scripting type.
Declaration
public virtual void GetMethods(const ScriptingTypeHandle& typeHandle, Array<void* >& methods) override
Parameters
ScriptingTypeHandle
typeHandle
The type to find methods inside it. |
Array<void >
methods
The output list of method pointers. |
Overrides
GetMethodSignature(void* method, ScriptingTypeMethodSignature& signature)
Gets the scripting type method signature metadata.
Declaration
public virtual void GetMethodSignature(void* method, ScriptingTypeMethodSignature& signature) override
Parameters
void
method
The method. |
ScriptingTypeMethodSignature
signature
The output method signature info. |
Overrides
GetModule(const MAssembly* assembly)
Finds the module by C# assembly.
Declaration
public static ManagedBinaryModule* GetModule(const MAssembly* assembly)
Parameters
MAssembly
assembly
The module C# assembly. |
Returns
ManagedBinaryModule
The found binary module or null if missing. |
GetName()
Gets the assembly name.
Declaration
public virtual StringAnsi GetName() const override
Returns
StringAnsi
The assembly name. |
Overrides
InvokeMethod(void* method, const Variant& instance, Span<Variant> paramValues, Variant& result)
Invokes a given scripting method.
Declaration
public virtual bool InvokeMethod(void* method, const Variant& instance, Span<Variant> paramValues, Variant& result) override
Parameters
void
method
The method. |
Variant
instance
The object instance to call it's member method. Unused for static methods. |
Span<Variant>
paramValues
The method parameters array. For output parameters the method writes the values back to the parameters. Length of this list has to match the method arguments amount. |
Variant
result
The output value method returned. Not used for void method. |
Returns
bool
True if failed, otherwise false. |
Overrides
IsLoaded()
Returns true if module is loaded, otherwise false (it might not be loaded yet or failed to load).
Declaration
public virtual bool IsLoaded() const override
Returns
bool
|
Overrides
ManagedObjectSpawn(const ScriptingObjectSpawnParams& params)
Declaration
public static ScriptingObject* ManagedObjectSpawn(const ScriptingObjectSpawnParams& params)
Parameters
ScriptingObjectSpawnParams
params
|
Returns
ScriptingObject
|
SetFieldValue(void* field, const Variant& instance, Variant& value)
Sets the value of a given scripting field.
Declaration
public virtual bool SetFieldValue(void* field, const Variant& instance, Variant& value) override
Parameters
void
field
The field. |
Variant
instance
The object instance to set its member field. Unused for static fields. |
Variant
value
The field value to assign. |
Returns
bool
True if failed, otherwise false. |