void OnDestroy() { if (state != 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. } }