Replies: 1 comment
-
Thanks for the proposal! Consolidating in #10644. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The Problem
Either due to a typo, or trying to be more descriptive, I change some of my variable's names, including exported ones. The issue is, if the exported variable is only assigned in the editor, you are not going to keep the value after renaming it.
This is specially frustrating for custom nested resources — that wouldn't really need to be saved to disk — as you lose them in one go, and trying to undo the name change won't bring it back. Also, Exported Nodes always have to get reassigned after renaming the variable, which is a slight inconvenience, but I often forget this fact and am reminded instantly by the game crashing.
Most Importantly however, this is an issue that you most often bump into by accident, either oblivious to the fact, or just because you're more focused on the code side of things, and less on how the exported variable is assigned in the editor.
The Solution
The idea is to retain the value assigned in the editor after renaming the variable. From a layman's perspective, I assume Godot thinks the renamed variable is just a new one and the old one got removed from the script. We could check if:
If those are met, the renamed variable is assigned the Node/Resource found in the editor. It might be more complex than this but I think this is the gist 😅
Beta Was this translation helpful? Give feedback.
All reactions