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

Exporting NodePath as a C# array don't work #82362

Closed
AndreSacilotto opened this issue Sep 26, 2023 · 0 comments · Fixed by #89756
Closed

Exporting NodePath as a C# array don't work #82362

AndreSacilotto opened this issue Sep 26, 2023 · 0 comments · Fixed by #89756

Comments

@AndreSacilotto
Copy link

Godot version

4.1.1 & 4.2-dev5

System information

win10

Issue description

The docs says it is possible to export NodePath in a native c# array, but in reality is not.
https://docs.godotengine.org/en/stable/tutorials/scripting/c_sharp/c_sharp_exports.html#exporting-c-arrays

Steps to reproduce

[Export] public NodePath[] NodePaths { get; set; }

And try to build you will receive a similar error message:

  modules/mono/glue/runtime_interop.cpp:1324 - System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
   ---> System.ArgumentNullException: Value cannot be null. (Parameter 'array')
     at Godot.Collections.Array..ctor(Span`1 array) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs:line 90
     at Godot.NativeInterop.VariantUtils.CreateFromSystemArrayOfNodePath(Span`1 from) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs:line 238
     at Project.Test.GetGodotPropertyDefaultValues() in ProjectPath\Godot.SourceGenerators\Godot.SourceGenerators.ScriptPropertyDefValGenerator\Project.Test_ScriptPropertyDefVal.generated.cs:line 11
     at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
     at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
     --- End of inner exception stack trace ---
     at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
     at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
     at Godot.Bridge.ScriptManagerBridge.GetPropertyDefaultValuesForType(Type type, IntPtr scriptPtr, IntPtr addDefValFunc) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs:line 992

Minimal reproduction project

easily reproducible

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