Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

OnApplicationQuit() order between different objects

Discussion in 'Editor & General Support' started by Benjamin-Perez, Aug 17, 2018.

  1. Benjamin-Perez

    Benjamin-Perez

    Joined:
    Jun 20, 2018
    Posts:
    1
    Hi everyone,

    I am using BestHTTP to communicate to the server using Sockets. Somewhere in the BestHTTP code there is an "OnApplicationQuit()" handler that close the socket. The problem is that, in one of my objects, i have another "OnApplicationQuit()" handler that need the socket to be still opened.

    It seems that the call order between the two handlers is random and i would like to know if there is something i can do to be sure that my handler is called bethere the BestHTTP's one.

    Thanks for your help
     
  2. samizzo

    samizzo

    Joined:
    Sep 7, 2011
    Posts:
    487
    I think the script execution order doesn't apply to OnApplicationQuit unfortunately. I think your best bet would be to remove or rename it (I believe BestHTTP comes with source?) and manually call it from your own OnApplicationQuit.

    Sam
     
  3. Cromfeli

    Cromfeli

    Joined:
    Oct 30, 2014
    Posts:
    202
    I recommend asking plugin specific questions at their own forum thread:
    https://forum.unity.com/threads/best-http-released.200006/

    The plugin seems to offer way to postpone network shutdown until your other activities are finished:
    Then once your other quit handling is done your next quit would return true and allow plugin to shut down the network communication also.
     
    samizzo likes this.