godotengine / godot

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

Exported variable resets to default after collapsing the structure #95976

Open witchpiggie opened 2 months ago

witchpiggie commented 2 months ago

Tested versions

4.3 Stable

System information

Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1070 (NVIDIA; 32.0.15.6070) - Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz (8 Threads)

Issue description

One of two exported variables in a scene will not save anything when changed in the editor.

Steps to reproduce

I have a scene with two exported variables. One in an Array and I can add things to it just fine. The other, I've tried several different things, but it always resets when I collapse it. For instance if I have it as @export var cats = Array[Dictionary]. In the editor, I add a Dictionary element to the 'cats' exported variable. I give the key a String value 'test'. I then add an Array as the value of the test key in the cats array. I add a couple int values into that "test" array. Now I should have the structure below

cats [
    {"test":[0,1,2,3]}
]

I hit ctrl+s to save. I click the button for the 'cats' exported variable to collapse the structure. Click the 'cats' exported variable button again to look at the structure, and it's all gone. Nothing saved. It's not in the scene file. I've tried changing variable names, I've tried reloading the project, etc. It always disappaers.

Minimal reproduction project (MRP)

test.zip

DCTewi commented 2 months ago

You need press the Add Key/Value Pair button to apply changes in Dictionary.

image

witchpiggie commented 2 months ago

@DCTewi From a quick test, it appears you might be correct on the issue.

If this is truly the problem, this should be changed. "Add New" and "Save" are different concepts. It's not clear that this must be done to save what is shown.