MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ToNative

Method ToNative

Source/Engine/Scripting/ScriptingObject.cpp:248–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248ScriptingObject* ScriptingObject::ToNative(MObject* obj)
249{
250 ScriptingObject* ptr = nullptr;
251#if USE_CSHARP
252 if (obj)
253 {
254#if USE_MONO || USE_MONO_AOT || DOTNET_HOST_MONO
255 const auto ptrField = MCore::Object::GetClass(obj)->GetField(ScriptingObject_unmanagedPtr);
256 CHECK_RETURN(ptrField, nullptr);
257 ptrField->GetValue(obj, &ptr);
258#else
259 static const MField* ptrField = MCore::Object::GetClass(obj)->GetField(ScriptingObject_unmanagedPtr);
260 ptrField->GetValueReference(obj, &ptr);
261#endif
262 }
263#endif
264 return ptr;
265}
266
267bool ScriptingObject::Is(const ScriptingTypeHandle& type) const
268{

Callers

nothing calls this directly

Calls 4

GetValueReferenceMethod · 0.80
GetClassFunction · 0.50
GetFieldMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected