Hey PixelMurder, If this is attached to a Quest, then if that Quest's ESP is deactivated, you'll run into the same problems I did.
The Script will not be able to UnregisterForUpdate () because it won't find the object it was attached to.
Regardless of where you attach this to, when the ESP is deactivated but the Scripts still exists, OnUpdate () will keep running on those Scripts.
But if you remove the Script as well, you'll hit onto the same problem. The OnUpdate () will keep trying to trigger itself on the non-existant Script.
The best option I've found is RegisterForSingleUpdate (). Then after the Onupdate (), you call RegisterForSingleUpdate () again.
Edit:
Basically, once registered to a reiterative event, the Event manager will continually send the events to the registered Scripts.
If the Script has been dettached from its Object (e.g. Quest, Spell, etc... when the ESP is deactiavted) but still exists, the variables the OnUpdate () uses will be invalid throwing errors.
And because the Script is not attached to any Object, Unregister calls in your code will fail.
The Event manager has no links to the Scripts invalid variables and properites and so is not affected by the errors.
And so it'll continually send events to the Script.
If the Script has been deleted, then the Event manager will still keep pinging that Script.
So the best option is to only register for one-off events.
After that event fires, it's done.
If the ESP has been deactivated, it'll fire that event.
The OnUpdate () fails because it's variables and properties become invalid.
At this point, the variables and properites attached to that Script is then discarded - according to the Wiki.
If the Script is deleted (by a Mod Manager when the mod is deactivated), the event will fail because there is Script to send it to.
But because it's a one-off event, it wont try to ping the Script again.
Properties and variables are also discarded in this cirumstance.
The problem arises with other reiterative events that have no one-off version.
E.g. OnSleepStart and OnSleepEnd.
Once registered, the Event manager will keep firing these events at invalid Scripts.
With these two events, I use IsPCSleeping Conditional Magic Effects attached to Abilities to detect when the player sleeps and wakes up.
Spoiler Also, it looks like we're trying to do the same thing in looking for a good "start-up" process for our Scripts.
Yours is very similar to mine: http://www.gamesas.com/topic/1349590-init-at-game-load-and-init-at-game-restart/Both look like they address the inital set-up of the Script.
However, mine tries to address OnGameLoaded () situations - when the mod author needs to add, change or override data from a previous version.
It's still not full-proof, however. If you spend more than 60 seconds in a menu, initGameLoaded () gets triggered.