|
@@ -207,7 +207,7 @@ namespace Godot
|
|
|
|
|
|
foreach (FieldInfo field in fields)
|
|
|
{
|
|
|
- Type fieldType = field.GetType();
|
|
|
+ Type fieldType = field.FieldType;
|
|
|
|
|
|
Variant.Type variantType = GD.TypeToVariantType(fieldType);
|
|
|
|
|
@@ -216,7 +216,7 @@ namespace Godot
|
|
|
|
|
|
static byte[] VarToBytes(in godot_variant var)
|
|
|
{
|
|
|
- NativeFuncs.godotsharp_var_to_bytes(var, false.ToGodotBool(), out var varBytes);
|
|
|
+ NativeFuncs.godotsharp_var_to_bytes(var, godot_bool.True, out var varBytes);
|
|
|
using (varBytes)
|
|
|
return Marshaling.ConvertNativePackedByteArrayToSystemArray(varBytes);
|
|
|
}
|
|
@@ -483,7 +483,7 @@ namespace Godot
|
|
|
|
|
|
if (fieldInfo != null)
|
|
|
{
|
|
|
- var variantValue = GD.BytesToVar(valueBuffer);
|
|
|
+ var variantValue = GD.BytesToVarWithObjects(valueBuffer);
|
|
|
object? managedValue = RuntimeTypeConversionHelper.ConvertToObjectOfType(
|
|
|
(godot_variant)variantValue.NativeVar, fieldInfo.FieldType);
|
|
|
fieldInfo.SetValue(recreatedTarget, managedValue);
|
|
@@ -799,7 +799,7 @@ namespace Godot
|
|
|
return func(variant);
|
|
|
|
|
|
if (typeof(GodotObject).IsAssignableFrom(type))
|
|
|
- return Convert.ChangeType(VariantUtils.ConvertTo<GodotObject>(variant), type, CultureInfo.InvariantCulture);
|
|
|
+ return VariantUtils.ConvertTo<GodotObject>(variant);
|
|
|
|
|
|
if (typeof(GodotObject[]).IsAssignableFrom(type))
|
|
|
{
|
|
@@ -818,7 +818,7 @@ namespace Godot
|
|
|
}
|
|
|
|
|
|
using var godotArray = NativeFuncs.godotsharp_variant_as_array(variant);
|
|
|
- return Convert.ChangeType(ConvertToSystemArrayOfGodotObject(godotArray, type), type, CultureInfo.InvariantCulture);
|
|
|
+ return ConvertToSystemArrayOfGodotObject(godotArray, type);
|
|
|
}
|
|
|
|
|
|
if (type.IsEnum)
|