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

Editing a built-in script won't update unless containing scene is saved #5535

Closed
magpie514 opened this issue Jul 3, 2016 · 11 comments
Closed

Comments

@magpie514
Copy link

Operating system or device - Godot version:
Ubuntu Linux 16.04 64b, Godot built from ac157f8

Issue description (what happened, and what was expected):
If you have a script that's built-in and modify it from the editor, while another scene is focused, changes won't take effect unless the scene containing the built-in script is saved. This can become kind of confusing when doing minute changes and not seeing them reflected in the project.

Steps to reproduce:
1 - Create a built-in script in a sub-scene, leave it in the script editor, then save the scene.
2 - Move to another scene and instance the sub-scene with the built-in script.
3 - Edit the built-in script and save it with ctrl+S (even if this saves the scene, it also saves scripts being edited even if it doesn't belong to that scene, so it's easy to forget)
4 - Run the scene with the instanced sub-scene. Changes won't be reflected.
5 - Re-focus the sub-scene and save it.
6 - Now it works.

@vnen
Copy link
Member

vnen commented Jul 3, 2016

Built-in scripts are so problematic that I wonder if they should be removed...

Anyway, I'm not sure how possible this is. The script is in the scene file, so you need to save the scene in order to save the script. And saving another scene from the script editor (or when saving a different scene) doesn't sound like a good idea usability-wise.

TBH I don't even like this "save all" function as it is, it's just convenient because Ctrl+S don't work for scripts.

@neikeq
Copy link
Contributor

neikeq commented Jul 3, 2016

@vnen I agree with you about built-in scripts. The only think I ever used them for was for quickly testing a script that I would remove later.

@magpie514
Copy link
Author

Well...I like built-in scripts as a good way to remove small scripting from the filesystem, specially when it's something not bound to be edited often. Laugh all you want but once they start piling on, it can become quite a nuisance to have 50 10-line scripts lying around in a folder.

@reduz
Copy link
Member

reduz commented Jul 7, 2016

it should be safer now to edit them, as Godot won't allow you to open them
if the scene is not loaded

On Wed, Jul 6, 2016 at 9:17 PM, Hetdegon notifications@github.com wrote:

Closed #5535 #5535.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#5535 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AF-Z2-LbxiMtwvkkjcnupHTqDzo2QNSOks5qTEWWgaJpZM4JD6jb
.

@akien-mga akien-mga added this to the 2.1 milestone Jul 7, 2016
@akien-mga
Copy link
Member

For the reference, fixed by a78226c.

@magpie514
Copy link
Author

Hmm, I just updated and noticed that if the built-in is already open in the editor, it still allows to modify it as normal, but with the same caveats as when I opened this issue. Perhaps this approach is wrong, and a "forced save" could be made on the containing scene instead?

@magpie514 magpie514 reopened this Jul 7, 2016
@akien-mga
Copy link
Member

I guess a78226c missed the second part of the fix: saving a builtin script should force saving its scene.

@akien-mga akien-mga modified the milestones: 2.1, 2.2 Aug 10, 2016
@akien-mga akien-mga removed this from the 2.2 milestone Aug 8, 2017
@magpie514
Copy link
Author

Issue #15406 might be related to this one?

@aaronfranke
Copy link
Member

Are built-in scripts still open for discussion? I've always just created separate files for my scripts, it's more useful this way even for small scripts, for example, scripts can be easily re-used later.

@magpie514
Copy link
Author

I personally disagree. When your script is just like 4 lines and not reusable (which is a thing that happens, specially with UI elements) making another file is just messy. Not to mention we already have to deal with extra data files for every image or icon, so a way to reduce file pollution would be great.

@KoBeWi
Copy link
Member

KoBeWi commented Nov 3, 2021

Reading the steps from the OP, the issue is resolved already. You can't edit a foreign built-in script anymore, its scene will be opened automatically and if you close the scene, the script is also closed. As long as the owning scene is opened, running the game will save it automatically (by default), so the changes are reflected.

The issue can thus be closed.

@KoBeWi KoBeWi closed this as completed Nov 3, 2021
@akien-mga akien-mga added this to the 3.3 milestone Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants