-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
C# Export on List not possible anymore. #70298
Comments
I can confirm that this is not working for me either, but fairly certain it was working in beta 6.
|
I doubt it was working in beta 6 because as far as I remember we removed support for .NET collections when we moved to .NET 6 (#64089), which I think was around alpha 16, and we haven't added support back. For now you should be able to use Keep in mind that converting between .NET collections and Godot collections is possible but can be very expensive because it requires marshaling every element. List<string> dotnetList = new List<string>() { "a", "b", "c" };
// List to Godot array
Godot.Collections.Array<string> godotArray = new Godot.Collections.Array<string>(dotnetList);
// Godot array to List
godotArray.ToList(); The commit that removed support for .NET collections (3123be2) includes more context:
|
Will C# Lists be supported in the future again? |
C# Lists and other Collections have significantly more features than Godot Arrays, and the conversion always has some code-overhead, that was not necessary in the past, so I would also greatly appreciate if exporting C# Lists became available again. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@LeonardoCruzx Please don't bump issues without contributing significant new information. Use the 👍 reaction button on the first post instead. |
I'm having a similar issue and trying to come up with some generic solution for this problem. My vision of the fix is not crystal-clear, and I haven't dabbled too deep in godotsharp technicalities, hence I'm not writing a proposal yet, but I'd like to test the waters first and ask for some opinions: godotengine/godot-proposals#10709 |
Godot version
v4.0.beta8.mono.official [45cac42]
System information
Windows 10 Home, Intel(R) Core(TM) i5-4210H CPU @ 2.90GHz 2.90 GHz,
Issue description
In Godot 3.5 it was possible to Export C# System.Collections.Generic.Lists.
When I try doing that in the current version I get the following error:
C:\Users\Bozo\Documents\Data\Game Dev\Godot\super-beat-boy\Nodes\Activables\GravityArea.cs(21,30): The type of the exported field is not supported: 'SuperBeatBoy.GravityArea.listOfStrings'
Would like to Export my lists and use them directly, this was very helpful and streamlined to use.
So this seems like a regression to me.
Steps to reproduce
Adding following Snippet to any Code:
[Export] private System.Collections.Generic.List<String> listOfString = new System.Collections.Generic.List<string>();
This leads to following error:
C:\Users\Bozo\Documents\Data\Game Dev\Godot\ListsNotWorking\lists_not_working.cs(8,53): The type of the exported field is not supported: 'lists_not_working.listOfString'
Expected Behaviour
Being able to change the list via the Inspector like you would do with arrays. (Or like you could in Godot 3.5 with List<>())
Minimal reproduction project
C#ListsNotWorking.zip
The text was updated successfully, but these errors were encountered: