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

Can't export a boolean array (bool[]) in C# (and passing it to an RPC doesn't work either) #70931

Closed
Steveplays28 opened this issue Jan 4, 2023 · 4 comments

Comments

@Steveplays28
Copy link

Steveplays28 commented Jan 4, 2023

Godot version

v4.0.beta10.mono.official [d0398f6]

System information

Windows 10

Issue description

I can't export a boolean array in C#.
The compiler output says the type is unsupported for export.

D:\Repos\first-person-shooter\common\scripts\Weapon.cs(8,25): The type of the exported field is not supported: 'FirstPersonShooter.Weapon.BooleanArray'

On top of that, I'm also unable pass a boolean array through the RPC system (using Rpc() or RpcId() functions):

Argument 2: cannot convert from 'bool[]' to 'Godot.Variant'

Steps to reproduce

  1. Export any bool[]:
[Export] public bool[] BooleanArray;
  1. Try to build the project, which fails with the error in the description ("The type of the exported field is not supported").

Minimal reproduction project

N/A

@Steveplays28
Copy link
Author

Steveplays28 commented Jan 4, 2023

I suppose this is related to #70298 (relevant comment)?
I was not aware that support for exporting .NET collections was removed.

@hawkerm
Copy link

hawkerm commented Oct 2, 2023

Yeah, I was trying to have an array of AnimatedSprite2D as a field or property and it's just never initialized, the array is empty in C#.

@ultrasuperpingu
Copy link

Enums array export is not working neither :)

@raulsntos
Copy link
Member

The only collections currently supported are the ones that are Variant-compatible as documented in the C# collections documentation. I want to re-add support for T[], List<T>, and Dictionary<TKey, TValue> where T is a Variant-compatible type. Follow the linked issue to track this.

@raulsntos raulsntos closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants