void OnDestroy() { if (state != null) { if (di != null) { di.close(); di = null; } // state is disposed by editorapplication if in the Editor // state isn't disposed in App because that all resources will be disposed by app on process exit. } }
// make sure lua state finalize at last // make sure LuaSvrGameObject excute order is max(9999) void OnDestroy() { if (state != null) { if (di != null) { di.close(); di = null; } state.Dispose(); state = null; } }
// make sure lua state finalize at last // make sure LuaSvrGameObject excute order is max(9999) void OnDestroy() { if (state != null) { if (di != null) { di.close(); di = null; } // Main state shouldn't dispose until app quit due to some mono behaviour use state on disposed // //state.Dispose(); //state = null; } }