internal static unsafe godot_bool Set(IntPtr godotObjectGCHandle, godot_string_name *name, godot_variant *value) { try { var godotObject = (Object)GCHandle.FromIntPtr(godotObjectGCHandle).Target; if (godotObject == null) { throw new InvalidOperationException(); } if (godotObject.SetGodotClassPropertyValue(CustomUnsafe.AsRef(name), CustomUnsafe.AsRef(value))) { return(godot_bool.True); } var nameManaged = StringName.CreateTakingOwnershipOfDisposableValue( NativeFuncs.godotsharp_string_name_new_copy(CustomUnsafe.AsRef(name))); Variant valueManaged = Variant.CreateCopyingBorrowed(*value); return(godotObject._Set(nameManaged, valueManaged).ToGodotBool()); } catch (Exception e) { ExceptionUtils.LogException(e); return(godot_bool.False); } }
internal static unsafe godot_bool Get(IntPtr godotObjectGCHandle, godot_string_name *name, godot_variant *outRet) { try { var godotObject = (Object)GCHandle.FromIntPtr(godotObjectGCHandle).Target; if (godotObject == null) { throw new InvalidOperationException(); } if (godotObject.GetGodotClassPropertyValue(CustomUnsafe.AsRef(name), out godot_variant outRetValue)) { *outRet = outRetValue; return(godot_bool.True); } var nameManaged = StringName.CreateTakingOwnershipOfDisposableValue( NativeFuncs.godotsharp_string_name_new_copy(CustomUnsafe.AsRef(name))); Variant ret = godotObject._Get(nameManaged); if (ret.VariantType == Variant.Type.Nil) { *outRet = default; return(godot_bool.False); } *outRet = Marshaling.ConvertManagedObjectToVariant(ret); return(godot_bool.True); } catch (Exception e) { ExceptionUtils.LogException(e); *outRet = default; return(godot_bool.False); } }