Skip to content

Conversation

@SlynxCZ
Copy link
Contributor

@SlynxCZ SlynxCZ commented Oct 21, 2025

Hi! This change makes sure that plugin capabilities get correctly re-registered after a hot reload.

Previously, when a plugin reloaded, its registered capability delegates (like PlayerCapability<T> or PluginCapability<T>) could still point to the old assembly context, which got unloaded right after. That meant other plugins were sometimes trying to call outdated or invalid delegates — leading to weird behavior or occasional crashes. 😅

Now, during hot reload, the plugin will:

  1. Unregister all old capabilities
  2. Rebuild new supplier delegates (using Expression.Lambda)
  3. Re-register them automatically for the fresh plugin instance

This keeps all providers up-to-date and prevents dangling references to old assemblies.
Overall, it just makes the capability system more stable and consistent when doing frequent plugin reloads. 👍

@SlynxCZ SlynxCZ requested a review from roflmuffin as a code owner October 21, 2025 13:58
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

Successfully merging this pull request may close these issues.

1 participant