Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NavigationServer3D.BakeFromSourceGeometryData has a default third parameter but in C# the default parameter doesn't work. #83349

Closed
viksl opened this issue Oct 14, 2023 · 3 comments · Fixed by #83357

Comments

@viksl
Copy link
Contributor

viksl commented Oct 14, 2023

Godot version

4.2 beta 1

System information

Windows 11 - Vulkan - Nvidia RTX 4070 - intel i5 13600KF

Issue description

The documentation says the BakeFromSourceGeometryData has a Callable() as a default third parameter, it works in gdscript (you can just use two paramaters) but in C# if you don't provide the third parameter (Callable) you will get an error when the code runs.

E 0:00:02:0226   Marshaling.cs:261 @ Godot.NativeInterop.godot_callable Godot.NativeInterop.Marshaling.ConvertCallableToNative(Godot.Callable&): System.NullReferenceException: Object reference not set to an instance of an object.
  <C# Error>     System.NullReferenceException
  <C# Source>    /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs:261 @ Godot.NativeInterop.godot_callable Godot.NativeInterop.Marshaling.ConvertCallableToNative(Godot.Callable&)
  <Stack Trace>  Marshaling.cs:261 @ Godot.NativeInterop.godot_callable Godot.NativeInterop.Marshaling.ConvertCallableToNative(Godot.Callable&)
                 NativeCalls.cs:5815 @ void Godot.NativeCalls.godot_icall_3_649(nint, nint, nint, nint, Godot.Callable&)
                 NavigationServer3D.cs:1277 @ void Godot.NavigationServer3D.BakeFromSourceGeometryData(Godot.NavigationMesh, Godot.NavigationMeshSourceGeometryData3D, Godot.Callable)
                 NavigationTest.cs:49 @ void NavigationTest._Ready()
                 Node.cs:2121 @ bool Godot.Node.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&)
                 Node3D.cs:1035 @ bool Godot.Node3D.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&)
                 NavigationTest_ScriptMethods.generated.cs:78 @ bool NavigationTest.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*)

Steps to reproduce

Use NavigationServer3D.BakeFromSourceGeometryData without a callable and with a callable to see the difference also do the same in gdscript (only without the callable parameter).

I'll provide MRP tomorrow or on monday.

Minimal reproduction project

I'll provide this on a day or two, I'm off right now.

@smix8
Copy link
Contributor

smix8 commented Oct 14, 2023

Can't really help with or debug C# specifics. I don't use or have a C# setup and it works with GDScript.

@raulsntos
Copy link
Member

This is all on C#'s side, we weren't considering "null" Callables when marshaling. #83357 should fix it.

@AThousandShips AThousandShips added this to the 4.2 milestone Oct 15, 2023
@viksl
Copy link
Contributor Author

viksl commented Nov 10, 2023

Just to track this also happens with ParseSourceGeometryData, I assume the fix will work everywhere just fine so I'm only adding this for the record. Thanks for the fix, hope it makes it into 4.2 soon ;).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants