godotengine / godotengine/godot
Exported PackedArrays are consistently reset in open scenes on script reload
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
v4.3.stable.official [77dcf97d8]
### System information
Godot v4.3.stable - Windows 10.0.22621 - Vulkan (Forward+) - dedicated AMD Radeon RX 5700 XT (Advanced Micro Devices, Inc.; 31.0.24031.5001) - AMD Ryzen 9 3950X 16-Core Processor (32 Threads)
### Issue description
If you save/touch a script that exports a PackedArray (I have tested Float32/64, Int32/64 and Color), then when reloading the script the editor silently resets the array to the default value given in the script in any scene that's opened.
I have tested and this does not occur with regular `Array[float]` or other `Array`s.
If the undo history has modifications to the exported array, you can go back to that and then back to the present to restore it.
Minimum reproduction script:
```
class_name ArrayTester extends Node
@export var arr : PackedFloat64Array = [1, 2, 3]
```
### Steps to reproduce
1. Create an empty project, or if using the MRP skip to step 4
2. Insert a node in the scene
3. Attach the above script to the node
4. Touch or save the script file to cause a reload (no need to make any actual modifications)
5. Focus the editor window
### Minimal reproduction project (MRP)
[repro_97156.zip](https://github.com/user-attachments/files/17077699/repro_97156.zip)
Contributor guide
Research direction
Start with the minimum reproduction script defining the exported PackedFloat64Array and follow the listed steps to reproduce the reset in an open scene. Compare PackedArray reload behavior with regular Array values; done means exported PackedArrays retain their edited values after the script is touched or reloaded.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- godot
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100