Script DeInit

 

Is there a DeInit type of handler for scripts?

 I have a script that is in a loop until a condition is met.  It creates a text object to say "Script Running".  When the condition is met I can delete that objects.  HOWEVER, when I exit the script manually, the text object remains.  DeInit doesn't seem to be called.  Is there any other way or handler to do some "clean up" upon manual stopping of a script? 

 

How do you terminate the script - by timeout or by a checking IsStopped ?

BTW, the script is a single method - from my point of view the OnDeinit is redundant, everything can be included in the single method.

Reason: