godotengine / godotengine/godot
C# [Export] Arrays not working on IOS builds 4.3 Beta
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Reproducible on 4.3 Beta 2 and 4.3 Beta 3
Not tested on other versions yet
NOTE **THIS IS C# SPECIFIC** - GDSCRIPT seems to be fine.
### System information
Godot v4.3.beta3.mono - Windows 10.0.19045 - GLES3 (Compatibility) - NVIDIA GeForce RTX 3080 (NVIDIA; 32.0.15.6070) - AMD Ryzen 9 5950X 16-Core Processor (32 Threads)
### Issue description
Tracked this down by use of GD.Prints.
This is in C#. I have Arrays which are marked as "Export" which are filled in with the editor. These work fine in windows and android Builds.
On IOS build, if I build it the built code says the array is of size 0.
### Steps to reproduce
In C#. Have an array of any type, which is exported and filled in the editor. For example, the way I found this bug was as follows.
```
[Export]
public Array buttons = new Array();
```
In the editor, add a couple of buttons to this array.
Then in the C# code, have something like :
GD.Print("Number of Buttons : " + buttons.Count);
When you run the code on Windows/Mac/Android - you'll get a debug log saying "Number of Buttons : 2" (or however many you added).
**HOWEVER..** On IOS, you'll get 0.
This will happen with ANY godot type added to array in the editor.
Also happens the exact same with the following code:
[Export]`public DrawNode2D[] subDrawNodes2 = null;`
### Minimal reproduction project (MRP)
EDIT: Added a small repro below.
[iosbug.zip](https://github.com/user-attachments/files/16355079/iosbug.zip)
Contributor guide
Research direction
Start by opening the attached iosbug.zip minimal reproduction project and reproduce the exported C# array behavior on an iOS build, comparing it with Windows or Android. The fix is complete when Godot types added to exported C# arrays are preserved on iOS and the reported count matches the editor contents.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, godot, ios
- Domain
- game-dev, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100