-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DllManipulatorScript is not the last GameObject calling OnDestroy when scene is being destroyed. #27
Comments
How about initializing dll when game started, and reset befor DllManipulatorScript's destructor is called? If My NativeApi object hold an refercence of DllManipulatorScript , it will stop DllManipulatorScript being GCed before all my GameObjects are destoryed. |
Something like this:
|
The problem is, at least when I last tested it, destructor is not called in editor when you just stop the game (or maybe only when it's the selected object in the scene, something of that nature). But if it turns out I'm wrong about that and it's gonna work fine, then yeah, I can change that. |
I tested, you are right. |
Luckly, mannally dll unloading works fine. |
The order of OnDestroy is not guaranteed, because the order of script excution doesn't work when calling OnDestroy.
The code above will raise IndexOutofBoundException randomly when stopping game in editor.
I dont know how to solve this problem.
I am using a stupid solution:
Is there better way?
The text was updated successfully, but these errors were encountered: