godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.89k stars 21.04k forks source link

Exported array variable (PackedInt32Array) in C# resets to default value when game is run #88215

Closed maridany1999 closed 7 months ago

maridany1999 commented 7 months ago

Tested versions

System information

Windows 11 - Godot_v4.3-dev3_mono_win64 - Vulkan (Forward+)

Issue description

When attempting to set an exported variable of type array through the Inspector in Godot, in this case an Array of Integers, the variable automatically reverts to its default value when the game is run. However, upon stopping the game, the variable returns to the manually set value. This behavior is unexpected and differs from previous versions of Godot where it worked as intended. The value should not reset when pressing Run Game.

This is Before and After Running: image

This is During Running: image

Steps to reproduce

1- Create Empty Project 2- Create Scene 3- Create a C# Script with an Exported Variable of type Array Int 4- Attach Script to a node 5- Set the Variable in the Inspector 6- Run the Game and observe the inspector in the Remote

Minimal reproduction project (MRP)

Test.zip

nongvantinh commented 7 months ago

24fe0715b53c6e599adfea9f69716db279be9db4 is the first bad commit commit 24fe0715b53c6e599adfea9f69716db279be9db4 Author: Juan Linietsky reduzio@gmail.com Date: Wed Jan 3 01:14:50 2024 +0100

Promote CowData to 64 bits

Fixes a lot of bugs, please help me fill the list.

core/io/packet_peer.cpp | 6 +- core/templates/cowdata.h | 152 ++++++++++++--------- core/templates/ring_buffer.h | 2 +- core/templates/vector.h | 69 +++++----- core/variant/variant_call.cpp | 2 +- modules/gdscript/gdscript_compiler.cpp | 2 +- modules/gdscript/gdscript_vm.cpp | 2 +- modules/lightmapper_rd/lightmapper_rd.cpp | 2 +- .../Core/NativeInterop/InteropStructs.cs | 20 +-- .../renderer_rd/storage_rd/light_storage.cpp | 2 +- 10 files changed, 145 insertions(+), 114 deletions(-)