Merge commit 'f74694048575160067734cbe27a023ad78a2c727' into 1.10

This commit is contained in:
Wojtek Figat
2024-10-03 10:23:07 +02:00
14 changed files with 149 additions and 81 deletions

View File

@@ -35,7 +35,7 @@ StringView StringView::Left(int32 count) const
StringView StringView::Right(int32 count) const
{
const int32 countClamped = count < 0 ? 0 : count < Length() ? count : Length();
return StringView(**this + Length() - countClamped);
return StringView(**this + countClamped, Length() - countClamped);
}
StringView StringView::Substring(int32 startIndex) const

View File

@@ -2449,7 +2449,9 @@ void Variant::SetType(const VariantType& type)
case VariantType::Structure:
AllocStructure();
break;
default: ;
default:
AsUint64 = 0;
break;
}
}
@@ -3065,6 +3067,69 @@ void Variant::DeleteValue()
SetType(VariantType(VariantType::Null));
}
Variant Variant::Parse(const StringView& text, const VariantType& type)
{
Variant result;
result.SetType(type);
if (text.IsEmpty())
return result;
if (type != VariantType())
{
switch (type.Type)
{
case VariantType::Bool:
if (text == TEXT("1") || text.Compare(StringView(TEXT("true"), 4), StringSearchCase::IgnoreCase) == 0)
result.AsBool = true;
break;
case VariantType::Int16:
StringUtils::Parse(text.Get(), &result.AsInt16);
break;
case VariantType::Uint16:
StringUtils::Parse(text.Get(), &result.AsUint16);
break;
case VariantType::Int:
StringUtils::Parse(text.Get(), &result.AsInt);
break;
case VariantType::Uint:
StringUtils::Parse(text.Get(), &result.AsUint);
break;
case VariantType::Int64:
StringUtils::Parse(text.Get(), &result.AsInt64);
break;
case VariantType::Uint64:
case VariantType::Enum:
StringUtils::Parse(text.Get(), &result.AsUint64);
break;
case VariantType::Float:
StringUtils::Parse(text.Get(), &result.AsFloat);
break;
case VariantType::Double:
StringUtils::Parse(text.Get(), &result.AsFloat);
result.AsDouble = (float)result.AsFloat;
break;
case VariantType::String:
result.SetString(text);
default:
break;
}
}
else
{
// Parse as number
int32 valueInt;
if (!StringUtils::Parse(text.Get(), text.Length(), &valueInt))
{
result = valueInt;
}
else
{
// Fallback to string
result.SetString(text);
}
}
return result;
}
bool Variant::CanCast(const Variant& v, const VariantType& to)
{
if (v.Type == to)

View File

@@ -381,6 +381,9 @@ public:
// Frees the object or data owned by this Variant container (eg. structure or object).
void DeleteValue();
// Parses the text into the Variant value. Allows to specify explicit value type.
static Variant Parse(const StringView& text, const VariantType& type = VariantType());
FORCE_INLINE Variant Cast(const VariantType& to) const
{
return Cast(*this, to);

View File

@@ -80,7 +80,7 @@ namespace
// Determinate a full path of an entry
char full_path[256];
ASSERT(pathLength + strlen(entry->d_name) < ARRAY_COUNT(full_path));
strcpy(full_path, path);
strcpy(full_path, pathStr);
strcat(full_path, "/");
strcat(full_path, entry->d_name);

View File

@@ -227,7 +227,7 @@ bool DeleteUnixPathTree(const char* path)
// Determinate a full path of an entry
char full_path[256];
ASSERT(pathLength + strlen(entry->d_name) < ARRAY_COUNT(full_path));
strcpy(full_path, path);
strcpy(full_path, pathStr);
strcat(full_path, "/");
strcat(full_path, entry->d_name);

View File

@@ -305,9 +305,9 @@ public:
/// <summary>
/// Checks if class has an attribute of the specified type.
/// </summary>
/// <param name="monoClass">The attribute class to check.</param>
/// <param name="klass">The attribute class to check.</param>
/// <returns>True if has attribute of that class type, otherwise false.</returns>
bool HasAttribute(const MClass* monoClass) const;
bool HasAttribute(const MClass* klass) const;
/// <summary>
/// Checks if class has an attribute of any type.
@@ -318,9 +318,9 @@ public:
/// <summary>
/// Returns an instance of an attribute of the specified type. Returns null if the class doesn't have such an attribute.
/// </summary>
/// <param name="monoClass">The attribute class to take.</param>
/// <param name="klass">The attribute class to take.</param>
/// <returns>The attribute object.</returns>
MObject* GetAttribute(const MClass* monoClass) const;
MObject* GetAttribute(const MClass* klass) const;
/// <summary>
/// Returns an instance of all attributes connected with given class. Returns null if the class doesn't have any attributes.

View File

@@ -99,9 +99,9 @@ public:
/// <summary>
/// Checks if event has an attribute of the specified type.
/// </summary>
/// <param name="monoClass">The attribute class to check.</param>
/// <param name="klass">The attribute class to check.</param>
/// <returns>True if has attribute of that class type, otherwise false.</returns>
bool HasAttribute(MClass* monoClass) const;
bool HasAttribute(const MClass* klass) const;
/// <summary>
/// Checks if event has an attribute of any type.
@@ -112,9 +112,9 @@ public:
/// <summary>
/// Returns an instance of an attribute of the specified type. Returns null if the event doesn't have such an attribute.
/// </summary>
/// <param name="monoClass">The attribute class to take.</param>
/// <param name="klass">The attribute class to take.</param>
/// <returns>The attribute object.</returns>
MObject* GetAttribute(MClass* monoClass) const;
MObject* GetAttribute(const MClass* klass) const;
/// <summary>
/// Returns an instance of all attributes connected with given event. Returns null if the event doesn't have any attributes.

View File

@@ -134,9 +134,9 @@ public:
/// <summary>
/// Checks if field has an attribute of the specified type.
/// </summary>
/// <param name="monoClass">The attribute class to check.</param>
/// <param name="klass">The attribute class to check.</param>
/// <returns>True if has attribute of that class type, otherwise false.</returns>
bool HasAttribute(MClass* monoClass) const;
bool HasAttribute(const MClass* klass) const;
/// <summary>
/// Checks if field has an attribute of any type.
@@ -147,9 +147,9 @@ public:
/// <summary>
/// Returns an instance of an attribute of the specified type. Returns null if the field doesn't have such an attribute.
/// </summary>
/// <param name="monoClass">The attribute class to take.</param>
/// <param name="klass">The attribute class to take.</param>
/// <returns>The attribute object.</returns>
MObject* GetAttribute(MClass* monoClass) const;
MObject* GetAttribute(const MClass* klass) const;
/// <summary>
/// Returns an instance of all attributes connected with given field. Returns null if the field doesn't have any attributes.

View File

@@ -175,9 +175,9 @@ public:
/// <summary>
/// Checks if method has an attribute of the specified type.
/// </summary>
/// <param name="monoClass">The attribute class to check.</param>
/// <param name="klass">The attribute class to check.</param>
/// <returns>True if has attribute of that class type, otherwise false.</returns>
bool HasAttribute(MClass* monoClass) const;
bool HasAttribute(const MClass* klass) const;
/// <summary>
/// Checks if method has an attribute of any type.
@@ -188,9 +188,9 @@ public:
/// <summary>
/// Returns an instance of an attribute of the specified type. Returns null if the method doesn't have such an attribute.
/// </summary>
/// <param name="monoClass">The attribute Class to take.</param>
/// <param name="klass">The attribute Class to take.</param>
/// <returns>The attribute object.</returns>
MObject* GetAttribute(MClass* monoClass) const;
MObject* GetAttribute(const MClass* klass) const;
/// <summary>
/// Returns an instance of all attributes connected with given method. Returns null if the method doesn't have any attributes.

View File

@@ -111,9 +111,9 @@ public:
/// <summary>
/// Checks if property has an attribute of the specified type.
/// </summary>
/// <param name="monoClass">The attribute class to check.</param>
/// <param name="klass">The attribute class to check.</param>
/// <returns>True if has attribute of that class type, otherwise false.</returns>
bool HasAttribute(MClass* monoClass) const;
bool HasAttribute(const MClass* klass) const;
/// <summary>
/// Checks if property has an attribute of any type.
@@ -124,9 +124,9 @@ public:
/// <summary>
/// Returns an instance of an attribute of the specified type. Returns null if the property doesn't have such an attribute.
/// </summary>
/// <param name="monoClass">The attribute class to take.</param>
/// <param name="klass">The attribute class to take.</param>
/// <returns>The attribute object.</returns>
MObject* GetAttribute(MClass* monoClass) const;
MObject* GetAttribute(const MClass* klass) const;
/// <summary>
/// Returns an instance of all attributes connected with given property. Returns null if the property doesn't have any attributes.

View File

@@ -1119,9 +1119,9 @@ const Array<MClass*>& MClass::GetInterfaces() const
return _interfaces;
}
bool MClass::HasAttribute(const MClass* monoClass) const
bool MClass::HasAttribute(const MClass* klass) const
{
return GetCustomAttribute(this, monoClass) != nullptr;
return GetCustomAttribute(this, klass) != nullptr;
}
bool MClass::HasAttribute() const
@@ -1129,9 +1129,9 @@ bool MClass::HasAttribute() const
return !GetAttributes().IsEmpty();
}
MObject* MClass::GetAttribute(const MClass* monoClass) const
MObject* MClass::GetAttribute(const MClass* klass) const
{
return (MObject*)GetCustomAttribute(this, monoClass);
return (MObject*)GetCustomAttribute(this, klass);
}
const Array<MObject*>& MClass::GetAttributes() const
@@ -1185,7 +1185,7 @@ MMethod* MEvent::GetRemoveMethod() const
return nullptr; // TODO: implement MEvent in .NET
}
bool MEvent::HasAttribute(MClass* monoClass) const
bool MEvent::HasAttribute(const MClass* klass) const
{
return false; // TODO: implement MEvent in .NET
}
@@ -1195,7 +1195,7 @@ bool MEvent::HasAttribute() const
return false; // TODO: implement MEvent in .NET
}
MObject* MEvent::GetAttribute(MClass* monoClass) const
MObject* MEvent::GetAttribute(const MClass* klass) const
{
return nullptr; // TODO: implement MEvent in .NET
}
@@ -1307,7 +1307,7 @@ void MField::SetValue(MObject* instance, void* value) const
CallStaticMethod<void, void*, void*, void*>(FieldSetValuePtr, instance, _handle, value);
}
bool MField::HasAttribute(MClass* monoClass) const
bool MField::HasAttribute(const MClass* klass) const
{
// TODO: implement MField attributes in .NET
return false;
@@ -1319,7 +1319,7 @@ bool MField::HasAttribute() const
return false;
}
MObject* MField::GetAttribute(MClass* monoClass) const
MObject* MField::GetAttribute(const MClass* klass) const
{
// TODO: implement MField attributes in .NET
return nullptr;
@@ -1469,7 +1469,7 @@ bool MMethod::GetParameterIsOut(int32 paramIdx) const
return CallStaticMethod<bool, void*, int>(GetMethodParameterIsOutPtr, _handle, paramIdx);
}
bool MMethod::HasAttribute(MClass* monoClass) const
bool MMethod::HasAttribute(const MClass* klass) const
{
// TODO: implement MMethod attributes in .NET
return false;
@@ -1481,7 +1481,7 @@ bool MMethod::HasAttribute() const
return false;
}
MObject* MMethod::GetAttribute(MClass* monoClass) const
MObject* MMethod::GetAttribute(const MClass* klass) const
{
// TODO: implement MMethod attributes in .NET
return nullptr;
@@ -1546,7 +1546,7 @@ void MProperty::SetValue(MObject* instance, void* value, MObject** exception) co
_setMethod->Invoke(instance, params, exception);
}
bool MProperty::HasAttribute(MClass* monoClass) const
bool MProperty::HasAttribute(const MClass* klass) const
{
// TODO: implement MProperty attributes in .NET
return false;
@@ -1558,7 +1558,7 @@ bool MProperty::HasAttribute() const
return false;
}
MObject* MProperty::GetAttribute(MClass* monoClass) const
MObject* MProperty::GetAttribute(const MClass* klass) const
{
// TODO: implement MProperty attributes in .NET
return nullptr;

View File

@@ -1517,10 +1517,10 @@ const Array<MClass*>& MClass::GetInterfaces() const
return _interfaces;
}
bool MClass::HasAttribute(const MClass* monoClass) const
bool MClass::HasAttribute(const MClass* klass) const
{
MonoCustomAttrInfo* attrInfo = GET_CUSTOM_ATTR();
return attrInfo != nullptr && mono_custom_attrs_has_attr(attrInfo, monoClass->GetNative()) != 0;
return attrInfo != nullptr && mono_custom_attrs_has_attr(attrInfo, klass->GetNative()) != 0;
}
bool MClass::HasAttribute() const
@@ -1529,10 +1529,10 @@ bool MClass::HasAttribute() const
return attrInfo && attrInfo->num_attrs > 0;
}
MObject* MClass::GetAttribute(const MClass* monoClass) const
MObject* MClass::GetAttribute(const MClass* klass) const
{
MonoCustomAttrInfo* attrInfo = GET_CUSTOM_ATTR();
return attrInfo ? mono_custom_attrs_get_attr(attrInfo, monoClass->GetNative()) : nullptr;
return attrInfo ? mono_custom_attrs_get_attr(attrInfo, klass->GetNative()) : nullptr;
}
const Array<MObject*>& MClass::GetAttributes() const
@@ -1618,14 +1618,14 @@ MMethod* MEvent::GetRemoveMethod() const
return _removeMethod;
}
bool MEvent::HasAttribute(MClass* monoClass) const
bool MEvent::HasAttribute(const MClass* klass) const
{
MonoClass* parentClass = mono_event_get_parent(_monoEvent);
MonoCustomAttrInfo* attrInfo = mono_custom_attrs_from_event(parentClass, _monoEvent);
if (attrInfo == nullptr)
return false;
const bool hasAttr = mono_custom_attrs_has_attr(attrInfo, monoClass->GetNative()) != 0;
const bool hasAttr = mono_custom_attrs_has_attr(attrInfo, klass->GetNative()) != 0;
mono_custom_attrs_free(attrInfo);
return hasAttr;
}
@@ -1646,14 +1646,14 @@ bool MEvent::HasAttribute() const
return false;
}
MObject* MEvent::GetAttribute(MClass* monoClass) const
MObject* MEvent::GetAttribute(const MClass* klass) const
{
MonoClass* parentClass = mono_event_get_parent(_monoEvent);
MonoCustomAttrInfo* attrInfo = mono_custom_attrs_from_event(parentClass, _monoEvent);
if (attrInfo == nullptr)
return nullptr;
MonoObject* foundAttr = mono_custom_attrs_get_attr(attrInfo, monoClass->GetNative());
MonoObject* foundAttr = mono_custom_attrs_get_attr(attrInfo, klass->GetNative());
mono_custom_attrs_free(attrInfo);
return foundAttr;
}
@@ -1771,14 +1771,14 @@ void MField::SetValue(MObject* instance, void* value) const
mono_field_set_value(instance, _monoField, value);
}
bool MField::HasAttribute(MClass* monoClass) const
bool MField::HasAttribute(const MClass* klass) const
{
MonoClass* parentClass = mono_field_get_parent(_monoField);
MonoCustomAttrInfo* attrInfo = mono_custom_attrs_from_field(parentClass, _monoField);
if (attrInfo == nullptr)
return false;
const bool hasAttr = mono_custom_attrs_has_attr(attrInfo, monoClass->GetNative()) != 0;
const bool hasAttr = mono_custom_attrs_has_attr(attrInfo, klass->GetNative()) != 0;
mono_custom_attrs_free(attrInfo);
return hasAttr;
}
@@ -1799,14 +1799,14 @@ bool MField::HasAttribute() const
return false;
}
MObject* MField::GetAttribute(MClass* monoClass) const
MObject* MField::GetAttribute(const MClass* klass) const
{
MonoClass* parentClass = mono_field_get_parent(_monoField);
MonoCustomAttrInfo* attrInfo = mono_custom_attrs_from_field(parentClass, _monoField);
if (attrInfo == nullptr)
return nullptr;
MonoObject* foundAttr = mono_custom_attrs_get_attr(attrInfo, monoClass->GetNative());
MonoObject* foundAttr = mono_custom_attrs_get_attr(attrInfo, klass->GetNative());
mono_custom_attrs_free(attrInfo);
return foundAttr;
}
@@ -1947,13 +1947,13 @@ bool MMethod::GetParameterIsOut(int32 paramIdx) const
return mono_signature_param_is_out(sig, paramIdx) != 0;
}
bool MMethod::HasAttribute(MClass* monoClass) const
bool MMethod::HasAttribute(const MClass* klass) const
{
MonoCustomAttrInfo* attrInfo = mono_custom_attrs_from_method(_monoMethod);
if (attrInfo == nullptr)
return false;
const bool hasAttr = mono_custom_attrs_has_attr(attrInfo, monoClass->GetNative()) != 0;
const bool hasAttr = mono_custom_attrs_has_attr(attrInfo, klass->GetNative()) != 0;
mono_custom_attrs_free(attrInfo);
return hasAttr;
}
@@ -1973,13 +1973,13 @@ bool MMethod::HasAttribute() const
return false;
}
MObject* MMethod::GetAttribute(MClass* monoClass) const
MObject* MMethod::GetAttribute(const MClass* klass) const
{
MonoCustomAttrInfo* attrInfo = mono_custom_attrs_from_method(_monoMethod);
if (attrInfo == nullptr)
return nullptr;
MonoObject* foundAttr = mono_custom_attrs_get_attr(attrInfo, monoClass->GetNative());
MonoObject* foundAttr = mono_custom_attrs_get_attr(attrInfo, klass->GetNative());
mono_custom_attrs_free(attrInfo);
return foundAttr;
}
@@ -2074,14 +2074,14 @@ void MProperty::SetValue(MObject* instance, void* value, MObject** exception) co
mono_property_set_value(_monoProperty, instance, params, exception);
}
bool MProperty::HasAttribute(MClass* monoClass) const
bool MProperty::HasAttribute(const MClass* klass) const
{
MonoClass* parentClass = mono_property_get_parent(_monoProperty);
MonoCustomAttrInfo* attrInfo = mono_custom_attrs_from_property(parentClass, _monoProperty);
if (attrInfo == nullptr)
return false;
const bool hasAttr = mono_custom_attrs_has_attr(attrInfo, monoClass->GetNative()) != 0;
const bool hasAttr = mono_custom_attrs_has_attr(attrInfo, klass->GetNative()) != 0;
mono_custom_attrs_free(attrInfo);
return hasAttr;
}
@@ -2102,14 +2102,14 @@ bool MProperty::HasAttribute() const
return false;
}
MObject* MProperty::GetAttribute(MClass* monoClass) const
MObject* MProperty::GetAttribute(const MClass* klass) const
{
MonoClass* parentClass = mono_property_get_parent(_monoProperty);
MonoCustomAttrInfo* attrInfo = mono_custom_attrs_from_property(parentClass, _monoProperty);
if (attrInfo == nullptr)
return nullptr;
MonoObject* foundAttr = mono_custom_attrs_get_attr(attrInfo, monoClass->GetNative());
MonoObject* foundAttr = mono_custom_attrs_get_attr(attrInfo, klass->GetNative());
mono_custom_attrs_free(attrInfo);
return foundAttr;
}

View File

@@ -388,7 +388,7 @@ const Array<MProperty*>& MClass::GetProperties() const
return _properties;
}
bool MClass::HasAttribute(const MClass* monoClass) const
bool MClass::HasAttribute(const MClass* klass) const
{
return false;
}
@@ -398,7 +398,7 @@ bool MClass::HasAttribute() const
return false;
}
MObject* MClass::GetAttribute(const MClass* monoClass) const
MObject* MClass::GetAttribute(const MClass* klass) const
{
return nullptr;
}
@@ -430,7 +430,7 @@ MMethod* MEvent::GetRemoveMethod() const
return _removeMethod;
}
bool MEvent::HasAttribute(MClass* monoClass) const
bool MEvent::HasAttribute(const MClass* klass) const
{
return false;
}
@@ -440,7 +440,7 @@ bool MEvent::HasAttribute() const
return false;
}
MObject* MEvent::GetAttribute(MClass* monoClass) const
MObject* MEvent::GetAttribute(const MClass* klass) const
{
return nullptr;
}
@@ -482,7 +482,7 @@ void MField::SetValue(MObject* instance, void* value) const
{
}
bool MField::HasAttribute(MClass* monoClass) const
bool MField::HasAttribute(const MClass* klass) const
{
return false;
}
@@ -492,7 +492,7 @@ bool MField::HasAttribute() const
return false;
}
MObject* MField::GetAttribute(MClass* monoClass) const
MObject* MField::GetAttribute(const MClass* klass) const
{
return nullptr;
}
@@ -537,7 +537,7 @@ bool MMethod::GetParameterIsOut(int32 paramIdx) const
return false;
}
bool MMethod::HasAttribute(MClass* monoClass) const
bool MMethod::HasAttribute(const MClass* klass) const
{
return false;
}
@@ -547,7 +547,7 @@ bool MMethod::HasAttribute() const
return false;
}
MObject* MMethod::GetAttribute(MClass* monoClass) const
MObject* MMethod::GetAttribute(const MClass* klass) const
{
return nullptr;
}
@@ -584,7 +584,7 @@ void MProperty::SetValue(MObject* instance, void* value, MObject** exception) co
{
}
bool MProperty::HasAttribute(MClass* monoClass) const
bool MProperty::HasAttribute(const MClass* klass) const
{
return false;
}
@@ -594,7 +594,7 @@ bool MProperty::HasAttribute() const
return false;
}
MObject* MProperty::GetAttribute(MClass* monoClass) const
MObject* MProperty::GetAttribute(const MClass* klass) const
{
return nullptr;
}

View File

@@ -277,10 +277,10 @@ void ScriptingObject::ChangeID(const Guid& newId)
// Update managed instance
const auto managedInstance = GetManagedInstance();
const auto monoClass = GetClass();
if (managedInstance && monoClass)
const auto klass = GetClass();
if (managedInstance && klass)
{
const MField* monoIdField = monoClass->GetField(ScriptingObject_id);
const MField* monoIdField = klass->GetField(ScriptingObject_id);
if (monoIdField)
monoIdField->SetValue(managedInstance, &_id);
}
@@ -344,10 +344,10 @@ bool ScriptingObject::CreateManaged()
#endif
{
// Other thread already created the object before
if (const auto monoClass = GetClass())
if (const auto klass = GetClass())
{
// Reset managed to unmanaged pointer
MCore::ScriptingObject::SetInternalValues(monoClass, managedInstance, nullptr, nullptr);
MCore::ScriptingObject::SetInternalValues(klass, managedInstance, nullptr, nullptr);
}
MCore::GCHandle::Free(handle);
return true;
@@ -366,17 +366,17 @@ bool ScriptingObject::CreateManaged()
MObject* ScriptingObject::CreateManagedInternal()
{
// Get class
MClass* monoClass = GetClass();
if (monoClass == nullptr)
MClass* klass = GetClass();
if (klass == nullptr)
{
LOG(Warning, "Missing managed class for object with id {0}", GetID());
return nullptr;
}
MObject* managedInstance = MCore::ScriptingObject::CreateScriptingObject(monoClass, this, &_id);
MObject* managedInstance = MCore::ScriptingObject::CreateScriptingObject(klass, this, &_id);
if (managedInstance == nullptr)
{
LOG(Warning, "Failed to create new instance of the object of type {0}", String(monoClass->GetFullName()));
LOG(Warning, "Failed to create new instance of the object of type {0}", String(klass->GetFullName()));
}
return managedInstance;
@@ -393,9 +393,9 @@ void ScriptingObject::DestroyManaged()
// Reset managed to unmanaged pointer
if (managedInstance)
{
if (const auto monoClass = GetClass())
if (const auto klass = GetClass())
{
MCore::ScriptingObject::SetInternalValues(monoClass, managedInstance, nullptr, nullptr);
MCore::ScriptingObject::SetInternalValues(klass, managedInstance, nullptr, nullptr);
}
}
@@ -522,10 +522,10 @@ bool ManagedScriptingObject::CreateManaged()
#endif
{
// Other thread already created the object before
if (const auto monoClass = GetClass())
if (const auto klass = GetClass())
{
// Reset managed to unmanaged pointer
MCore::ScriptingObject::SetInternalValues(monoClass, managedInstance, nullptr, nullptr);
MCore::ScriptingObject::SetInternalValues(klass, managedInstance, nullptr, nullptr);
}
MCore::GCHandle::Free(handle);
return true;
@@ -684,9 +684,9 @@ DEFINE_INTERNAL_CALL(void) ObjectInternal_ManagedInstanceCreated(MObject* manage
actor->SetName(String(typeClass->GetName()));
}
MClass* monoClass = obj->GetClass();
MClass* klass = obj->GetClass();
const Guid id = obj->GetID();
MCore::ScriptingObject::SetInternalValues(monoClass, managedInstance, obj, &id);
MCore::ScriptingObject::SetInternalValues(klass, managedInstance, obj, &id);
// Register object
if (!obj->IsRegistered())