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

Scripts not reloading in editor #23

Open
bram-dingelstad opened this issue Apr 17, 2022 · 3 comments
Open

Scripts not reloading in editor #23

bram-dingelstad opened this issue Apr 17, 2022 · 3 comments

Comments

@bram-dingelstad
Copy link

Technically it makes a lot more sense to make this an issue in the Godot repo, but thought it'd be worth tracking here as well.

I found this issue as part of the Known Limitations while I was working on #22. I also wonder what the .gdnlib properties called load_once and reloadable have to do with this.

I figured out that the native GDScript solution has a method called reload that we just need to implement in the PluginScript class of the Godot repo (together with some additions to the language descriptors).

Once we have that we just need to make some functions in our language_gdnative.c and we're set!

@gilzoide
Copy link
Owner

I also wonder what the .gdnlib properties called load_once and reloadable have to do with this.

These are regarding the GDNative library loading/reloading and doesn't affect the PluginScript language.
load_once is a flag for the engine to load the shared library only once, regardless of how many scripts reference it.
reloadable marks that the GDNative Library can be recompiled and reloaded without restarting the editor. This is marked as false for Lua PluginScript because it is a singleton library and, as by the docs, singleton libraries cannot be reloadable.

I think what is missing for the editor to reload existing scripts reload_all_scripts / reload_tool_script, but I'm not really sure. Maybe there is something the plugin could do to reload stuff, but I haven't searched too much.

@bram-dingelstad
Copy link
Author

From what I've seen the reload_all_scripts and reload_tool_script only seem to be relevant in a DEBUG context.

I'm not sure if that's a distro flag that makes it into production versions of Godot. It seems to be a shorthand for debugging purposes that just calls reload on all those script instances.

@gilzoide
Copy link
Owner

gilzoide commented Apr 17, 2022

Script reloading is supported both in the editor build (which cannot be release builds and have DEBUG_ENABLED) and debug builds, so that the remote debugger can reload them. I guess this is what is called in editor to reload everything, but I'm still not 100% sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants