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

Exported Variables disappearing in editor upon launching a scene #82266

Closed
JWR26 opened this issue Sep 24, 2023 · 11 comments · Fixed by #96007
Closed

Exported Variables disappearing in editor upon launching a scene #82266

JWR26 opened this issue Sep 24, 2023 · 11 comments · Fixed by #96007

Comments

@JWR26
Copy link

JWR26 commented Sep 24, 2023

Godot version

v4.1.1.stable.official

System information

Windows 10 Pro

Issue description

When running a scene, the exported variables that have been set in the editor are "null" and causing a crash. Below is a screen shot showing the remote scene where the variables are null. This is followed by a screenshot of the local scene where we can see that the exported variables do not appear.

image

image

On both screenshots, it can be clearly seen that there are 3 exported variables in the script of the scene in question.

Upon stopping the scene and returning to the editor, the exported variables have dissapeared from the inspector panel. Reloading the scene does not make them reappear. I am obliged to restart godot then reassign the exported variables.

This does not occur at regular intervals and happens intermittently, notably when I am editing the scripts of the "exported nodes" classes.

Steps to reproduce

the error is happening when running the test_arena.tscn in entities/arena. Currently the exported variables are unassigned, so assign them (only one possible node per variable) and then run the scene.

Edit the scripts res://entities/ship/player_input_component.gd and res://entities/ship/weapon_component.gd for example then re-run the project.

As mentioned in the issue, the problem happens sporadically therefore several reruns of these steps may be required to have the game crash on a null instance.

Minimal reproduction project

godot_export_crash_issue.zip

@itzevvv
Copy link

itzevvv commented Sep 29, 2023

Can confirm I'm also experiencing this, 4.1.1 stable

@Lennart1514
Copy link

I noticed that when a node inherints from multiple script (one script extends another), only the variables declared in one the scripts get lost.

@AThousandShips AThousandShips changed the title Exported Variables dissapearing in editor upon launching a scene Exported Variables disappearing in editor upon launching a scene Dec 2, 2023
@benfc1993
Copy link

benfc1993 commented Feb 18, 2024

This appears to only happen when interface/editor/update_continuously is enabled, confirmed still existing in 4.2.1 stable.mono

@BlackDragonBE
Copy link

Happened to me in 4.2.2 stable. Update Continuously wasn't enabled, enabling it didn't change anything. Reloading the project fixes it.

@vnen
Copy link
Member

vnen commented May 17, 2024

Could not reproduce on master. This needs more specific steps to reproduce, otherwise it's going to be difficult to pinpoint the issue.

@vnen vnen moved this from For team assessment to Needs further info in GDScript Issue Triage May 18, 2024
@kwameopareasiedu
Copy link

Also experiencing this with 4.2.2 stable. Included a screen recording for clarity

godot-exported-array-disappearing.mp4

image

@oebelysk
Copy link

Had the same problem on 4.3 stable. When the project was saved or run, the variables and their values would disappear until the script was saved.

I am using VSCode as a text editor and the script was inheriting from another script that also had export variables. Restarting the project fixed everything however.

@eldinoyev
Copy link

Same exact issue here with v4.3.stable.mono.official on MacOS. As others have said, reloading fixes the problem.

@TheOakleaf
Copy link

Same issue at 4.3.stable.official Win11
using vsCode as an external editor.
Restarting editor fixes issue temporarily.

@BlackDragonBE
Copy link

@vnen I think I finally found the root cause. In some instances, a script gets opened in Godot's script editor even though "Use External Editor" is enabled, this causes issues as Godot seems to try to update the script via the internal editor even though it should ignore that and use the code from the external editor.

I noticed I had several script files open in Godot every time the issue happened.

Steps to replicate the issue in Godot 4.3:

  1. Turn off Use External Editor in Editor Settings.
  2. Create a new script with a single @export, an AudioStream for example, and save the script.
  3. Attach the script to a node in a new scene.
  4. Save the scene.
  5. Turn on Use External Editor in Editor Settings.
  6. Open VS Code for example and use it to edit the script: add another @export and save the script.
  7. Return to Godot, the new exported value should be visible. Try assigning anything to it and save the scene.
  8. The new exported value disappears.
  9. Open the Script tab in Godot and close all scripts.
  10. Save the script in VS Code again.
  11. Try using the new exported value in Godot and save the scene. It should work as expected now.

That still doesn't explain why Godot still opens script files in its internal editor sometimes in the background, but it's a start.

@akien-mga
Copy link
Member

Fixed by #96007 (thanks @BlackDragonBE for confirming).

@github-project-automation github-project-automation bot moved this from Needs further info to Done in GDScript Issue Triage Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.