Skip to content

DllManipulatorScript is not the last GameObject calling OnDestroy when scene is being destroyed. #27

Description

@zhmt

The order of OnDestroy is not guaranteed, because the order of script excution doesn't work when calling OnDestroy.

class OneObj : MonoBehavior {
  void OnDestroy() { NativeApi.test(); }
}

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:

  1. invoke DllManipulatorScript.Reinitialize in Awake(){} when game started.
  2. manually invoke DllManipulatorScript.Reset via menu item before building cpp dll.

Is there better way?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions