Skip to content
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

Document unexpected behavior when exported arrays are shared #5640

Open
me2beats opened this issue Feb 23, 2022 · 1 comment
Open

Document unexpected behavior when exported arrays are shared #5640

me2beats opened this issue Feb 23, 2022 · 1 comment
Labels
area:manual Issues and PRs related to the Manual/Tutorials section of the documentation enhancement

Comments

@me2beats
Copy link

Your Godot version:
3.5 beta, 3.4 stable

Issue description:

class Test:
	extends Node
	export var x = []

func _ready():
	var test1 = Test.new()
	var test2 = Test.new()
	test1.x.append(0)
	print(test2.x)

godotengine/godot#48038

This is unexpected because I assume exported vars are kinda regular vars (properties), not constants.

URL to the documentation page (if already existing):
gdscript_exports is the right place to clarify this behavior imo
https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_exports.html

@zacryol
Copy link
Contributor

zacryol commented May 14, 2022

The specific issue, as of the last time I checked, was:

If an export var Array/Dict has a default value set in code, then any instance that does not have that value changed to something else via the editor will share a reference to that array/dict.

Seems to be fixed in master though.

@skyace65 skyace65 added the area:manual Issues and PRs related to the Manual/Tutorials section of the documentation label Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:manual Issues and PRs related to the Manual/Tutorials section of the documentation enhancement
Projects
None yet
Development

No branches or pull requests

3 participants