You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 24, 2023. It is now read-only.
RegisterForUpdate is a function that in almost all cases can be replaced by the safer RegisterForSingleUpdate. A nice feature would be a warning for anyone who uses this function, so they can consider using RegisterForSingleUpdate instead.
Highlights of the issue for RegisterForUpdate from the papyrus wiki, rewritten for simplification:
If a mod is removed, its OnUpdate handler will still be registered and the game engine will continue to try to invoke it.
Even if your mod still exists, you may not exclude the possibility that a bug manifests itself and causes periodic errors. A better behavior if your event handler contains a bug would be to cancel the automatic updates, which is achieved through RegisterForSingleUpdate.
Modifying the OnUpdate handler has no effect: as long as the old handler was registered, it will continue to be used unless you explicitly unregister for updates, then register again.
If the OnUpdate handler takes longer than the interval specified in RegisterForUpdate, the event calls can stack, causing stack dumps, save game bloat, script lag, etc.
Using RegisterForSingleUpdate can avoid all those problems, and is the preferred alternative to RegisterForUpdate for most use cases.
RegisterForUpdateis a function that in almost all cases can be replaced by the saferRegisterForSingleUpdate. A nice feature would be a warning for anyone who uses this function, so they can consider usingRegisterForSingleUpdateinstead.Highlights of the issue for
RegisterForUpdatefrom the papyrus wiki, rewritten for simplification:OnUpdatehandler takes longer than the interval specified inRegisterForUpdate, the event calls can stack, causing stack dumps, save game bloat, script lag, etc.Using
RegisterForSingleUpdatecan avoid all those problems, and is the preferred alternative toRegisterForUpdatefor most use cases.