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

Script default value instances are reused, causing unexpected behavior #423

Closed
Naros opened this issue Jun 19, 2024 · 0 comments · Fixed by #430
Closed

Script default value instances are reused, causing unexpected behavior #423

Naros opened this issue Jun 19, 2024 · 0 comments · Fixed by #430
Labels
bug/confirmed Bug/regression has been confirmed. cherrypick:2.0 Requires cherry-pick to Orchestrator 2.0 kind/bug A bug or regression in expected behavior.
Milestone

Comments

@Naros
Copy link
Member

Naros commented Jun 19, 2024

Describe the bug

Given the following nodes:

image

When the arr input pin is connected with a Make Array node, each call to the node will use a new Array instance. For this use case that was the desired outcome. However, if a Make Array node was not connected, this node used an Array instance from the default value cache, which was re-used on each call. This re-use in this context causes the array to continuously grow due to the function's logic appending elements to this array on each call.

This raises the question, should default values always create a new instance.

Expected behavior

The user behavior should be the same regardless of whether a Make Array node is or is not connected.

Actual behavior

The same Array instance is re-used when the arr pin has no connection.

How to Reproduce?

No response

Godot full version

N/A

Orchestrator version

2.0.1.stable

Additional information

No response

@Naros Naros added kind/bug A bug or regression in expected behavior. bug/confirmed Bug/regression has been confirmed. cherrypick:2.0 Requires cherry-pick to Orchestrator 2.0 labels Jun 19, 2024
Naros added a commit to Naros/godot-orchestrator that referenced this issue Jun 22, 2024
@Naros Naros added this to the 2.1 milestone Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/confirmed Bug/regression has been confirmed. cherrypick:2.0 Requires cherry-pick to Orchestrator 2.0 kind/bug A bug or regression in expected behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant