Added: ScriptingObject* TryFindObject(MClass* mclass), Allow you from c++ to use MAssembly GetBinaryModuleGame, and get a monoobject from a class, monoobject is needed later to Invoke a method from the class.
This commit is contained in:
@@ -868,6 +868,23 @@ ScriptingObject* Scripting::TryFindObject(Guid id, MClass* type)
|
||||
return result;
|
||||
}
|
||||
|
||||
ScriptingObject* Scripting::TryFindObject(MClass* mclass)
|
||||
{
|
||||
if (mclass == nullptr)
|
||||
return nullptr;
|
||||
|
||||
ScopeLock lock(_objectsLocker);
|
||||
|
||||
for (auto i = _objectsDictionary.Begin(); i.IsNotEnd(); ++i)
|
||||
{
|
||||
const auto obj = i->Value;
|
||||
if(obj->GetClass() == mclass)
|
||||
return obj;
|
||||
}
|
||||
return nullptr;
|
||||
|
||||
}
|
||||
|
||||
ScriptingObject* Scripting::FindObject(const MObject* managedInstance)
|
||||
{
|
||||
if (managedInstance == nullptr)
|
||||
|
||||
Reference in New Issue
Block a user