godot_input_helper icon indicating copy to clipboard operation
godot_input_helper copied to clipboard

Serializing inputs from C# with no arguments throws an exception

Open guessy42 opened this issue 1 year ago • 1 comments

Describe the bug

Calling InputHelper.SerializeInputsForActions(); without arguments throws an Invalid Type error:

E 0:00:04:0619 GD.cs:366 @ void Godot.GD.PushError(string): Invalid type in function 'serialize_inputs_for_actions' in base 'Godot.Node'. Cannot convert argument 1 from StringName to PackedStringArray. <C# Source> /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs:147 @ void Godot.NativeInterop.ExceptionUtils.DebugCheckCallError(Godot.NativeInterop.godot_string_name, nint, Godot.NativeInterop.godot_variant**, int, Godot.NativeInterop.godot_variant_call_error) <Stack Trace> GD.cs:366 @ void Godot.GD.PushError(string) ExceptionUtils.cs:147 @ void Godot.NativeInterop.ExceptionUtils.DebugCheckCallError(Godot.NativeInterop.godot_string_name, nint, Godot.NativeInterop.godot_variant**, int, Godot.NativeInterop.godot_variant_call_error) NativeCalls.cs:6312 @ Godot.Variant Godot.NativeCalls.godot_icall_2_701(nint, nint, Godot.NativeInterop.godot_string_name, Godot.Variant[], Godot.NativeInterop.godot_string_name) GodotObject.cs:622 @ Godot.Variant Godot.GodotObject.Call(Godot.StringName, Godot.Variant[]) InputHelper.cs:87 @ string NathanHoad.InputHelper.SerializeInputsForActions(Godot.Collections.Array1[System.String]) GameOptions.cs:140 @ void SilentWakeV2.GameOptions.PreSave() GameOptions.cs:74 @ void SilentWakeV2.GameOptionsManager.SaveOptions() OptionsMenu.cs:65 @ void SilentWakeV2.Menus.OptionsMenu.ApplySettings() SilentWakeV2.Menus.OptionsMenu_ScriptMethods.generated.cs:101 @ bool SilentWakeV2.Menus.OptionsMenu.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&) CSharpInstanceBridge.cs:24 @ Godot.NativeInterop.godot_bool Godot.Bridge.CSharpInstanceBridge.Call(nint, Godot.NativeInterop.godot_string_name*, Godot.NativeInterop.godot_variant**, int, Godot.NativeInterop.godot_variant_call_error*, Godot.NativeInterop.godot_variant*) `

Affected version

  • Input Helper version: 4.4.0
  • Godot version: 4.2.2

To Reproduce Steps to reproduce the behavior:

  1. Have a C# script call InputHelper.SerializeInputsForActions(); without any arguments
  2. Error will appear in Godot's Debugger (Visual Studio Code will not catch this) and inputs will not be serialized
  3. Of note, calling InputHelper.SerializeInputsForActions(null); will not cause any errors and serializes all inputs correctly

guessy42 avatar May 17 '24 12:05 guessy42

I can't seem to replicate this. When I call:

GD.Print("Serialized Inputs:", InputHelper.SerializeInputsForActions());

I get expected output:

image

nathanhoad avatar Jun 28 '24 00:06 nathanhoad