Plugin changes are only interpreted when I exit and re-enter Studio

Reproduction Steps

Make some changes on the plugin using the Studio’s script editor and run the plugin.

Expected Behavior

Changes made to the plugin script should be interpreted immediately, saving or not.

Actual Behavior

Save or don’t save the plugin after changes, it won’t make a difference.

Workaround

I have to restart Studio every time I make a change to the plugin in order for this change to be interpreted.

Issue Area: Studio
Issue Type: Other
Impact: Moderate
Frequency: Constantly

Can you clarify your reproduction steps? Are you editing your script directly through the debugger plugin instance? What method are you using to save and load plugin changes?

I personally haven’t encountered this issue yet. Any time I have saved to file and used the “Reload Plugin” or used the “Save and Reload Plugin” button directly from the debugger, it always stops any previous instances of the plugin and executes the latest revision.

Thanks for the report! We’ll investigate.

2 Likes

The Plugin lifecycle is as follows:

  1. When you open a place, the plugins load into the Edit DataModel (DM).
  2. When you Run a place, the plugins run in the Client (and Server) DM
  3. When you hit stop, the Plugins are unloaded from the Client (and Server) DM
  4. When a place is unloaded the plugins unload from the Edit DM

You can test this by logging the DM type from the relevant plugin events (Ready and Unloading respectively):

If the plugin script changes would be interpreted immediately, the result would be undefined behavior and possible crashes in event handlers and threads that are using parts of the currently loaded DataModel. Thus the only option to terminate plugins is to unload the current DataModel.

On the other hand if you’re developing plugins with a small place, it should be fairly painless to load/unload it.

You can also invoke parts of the plugin code using the Command line if your plugin is well modularized and its components are independently loadable and executable.

How to have the plugin changes interpreted without leaving studio?

You don’t need to reopen Studio; just install the plugin for local development with “Save as Local Plugin” (right click context menu action). Every time you need to reboot the plugin, just reinstall it again like this and it should refresh your plugin bar and immediately run the new version of the plugin.

Automatically re-running your plugin on any change might not be desirable in all situations if your code is spread over multiple files. Many plugins consist of multiple module scripts that need to interact with each other.

Either way, this is not a bug but a missing feature, you should move it to Studio Features.

If you want to stay in Edit Mode, you can close the place of your plugin and reopen it for the plugin reload.

Another technique is to have a single, very simple point of entry for your plugin, and all the rest of the logic reachable from there but also triggerable by a (debug) UI or Command line that is removed for publishing. That way you don’t have to unload every time, just hit the trigger.

Hope this helps…

For all these steps, it’s still faster to close and open studio.
So I ask for a better plugin development workflow.

I forgot, but there is one more way of restarting the plugin debugging in Edit mode without closing anything (this might be what you’re looking for): by using the Right Click + Save and Reload plugin on the plugin under the PluginDebugService in Explorer:

The problem with auto reload is that some people might not have your exact workflow and would like to have some control over when things are reloaded; imagine having to deal with a reload on every keystroke or every few seconds if we debounce. Even if it worked for you, it wouldn’t for a set of other people.

Additionally, while it is possible to reload the plugin itself without the DataModel reloading, it is generally problematic to change or reload code that is running.

In the end we’re trying to be respectful and create a predictable solution that covers most use cases; prioritizing for the features and bugs that might affect more people, without compromising stability.

2 Likes

Ok this might be unrelated but can we have a Reload All Plugins option that loads new plugins I dragged in to the Local Plugins folder externally

Right now I have to reload the Edit datamodel for those plugins to load

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.