godot_input_helper icon indicating copy to clipboard operation
godot_input_helper copied to clipboard

C# SerializeInputsForActions throws error, GDScript version runs fine

Open Aman-Anas opened this issue 1 year ago • 0 comments

Describe the bug I tried serializing the default key map with InputHelper.SerializeInputsForActions(); in a C# script, but it threw a strange error related to invalid function arguments. A simple workaround is to use InputHelper.Instance.Call("serialize_inputs_for_actions").

E 0:00:01:0187   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:88 @ string NathanHoad.InputHelper.SerializeInputsForActions(Godot.Collections.Array`1[System.String])
                 SettingsMenu.cs:26 @ void SettingsMenu._Ready()
                 Node.cs:2137 @ bool Godot.Node.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&)
                 CanvasItem.cs:1370 @ bool Godot.CanvasItem.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&)
                 Control.cs:2841 @ bool Godot.Control.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&)
                 Container.cs:136 @ bool Godot.Container.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&)
                 MarginContainer.cs:50 @ bool Godot.MarginContainer.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&)
                 SettingsMenu_ScriptMethods.generated.cs:58 @ bool SettingsMenu.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: Seems to be 4.3.3
  • Godot version: 4.2.2 stable

To Reproduce Steps to reproduce the behavior:

  1. Call InputHelper.SerializeInputsForActions(); in a node. I put it in a _ready().

Expected behavior Would normally expect it to work the same as InputHelper.Instance.Call("serialize_inputs_for_actions").

Aman-Anas avatar May 14 '24 22:05 Aman-Anas