Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Unity Understanding Order of Execution for Event Functions

Discussion in 'Unite Now' started by AskCarol, Oct 13, 2020.

  1. AskCarol

    AskCarol

    Unity Technologies

    Joined:
    Nov 12, 2019
    Posts:
    236
    Understanding Order of Execution for Event Functions


    Date: Thursday, October 15
    Time: 9:00 a.m. PDT

    Watch this session to learn how Unity calls event functions over a script’s lifetime. Also, see how you can use the Configurable Enter Play Mode option to speed up iteration time. Learn more.

    Feel free to ask your questions in the comments!


     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    5,264
    Some feedback:
    So the video claims that OnEnable is only called once. That's very wrong!

    It also doesn't explain why replacing Start with Awake makes things happen in the correct order, just that they do. It should probably clearly explain how the methods relates to Instantiate(), since that's the important part there.

    The advice for what happens with deactivated scene reloads is a bit bogus - the advice is that you should activate scene reloading if you want to profile how long the scene takes to start in builds. That's not a good idea! While it's more accurate than with scene reloading turned off, the correct way to profile that is to make a build!


    Some questions:
    OnApplicationPause is a weird beast - when exactly is it called? Can it be called in standalone pc builds? The video doesn't say, and neither does the documentation, as far as I can tell. I've always assumed that it's a mobile only thing, as mobile platforms deactivate applications in a very different way from pc platforms, but I don't know, and it's not written down, as far as I can tell.

    How the execution order works with regards to [ExecuteInEditMode] and [ExecuteAlways] is not documented and poorly understood. So if you could go into that, and how it relates to domain reloads and exiting play mode, that'd be great.
     
    Last edited: Oct 28, 2020
    senkal_, Deozaan and AskCarol like this.
  3. KristinStock

    KristinStock

    Unity Technologies

    Joined:
    Aug 26, 2020
    Posts:
    1
    Hi Baste :),
    it's true - I probably simplified too much in some areas, but we are planning to also write a more detailed blog post about it so I hope I get to redeem myself there!

    As for your questions: OnApplicationPause is a bit of a strange case because after being called one more frame is executed, which is to allow for things like pause screens. It works on Standalone as well as on mobile devices. There is this wonderful write-up on the order of execution and configurable enter play mode that alexeyzakharov wrote a while back, which I highly suggest if you need more information!
     
    Baste likes this.
  4. AIParanavithana

    AIParanavithana

    Joined:
    Aug 7, 2020
    Posts:
    8
    Unity Package Manager Diagnostics (v0.1.5)
    ============
    Ran 7 checks
    ============
    2 succeeded
    5 failed
    ============
    ❌ UPM registry reachable (FAIL)
    Make an HTTP request to the UPM package registry
    >> Connection error.

    ❌ Ping UPM registry (FAIL)
    Measure the latency of the UPM package registry API
    >> No successful pings could be made in 6.344 seconds (3 failed)

    ❌ Ping UPM download (FAIL)
    Measure the latency of the UPM package download endpoint
    >> No successful pings could be made in 6.541 seconds (3 failed)

    ❌ UPM registry download speed (FAIL)
    Test the Internet connection using the UPM package registry
    >> Connection error.

    ❌ Speedtest.net (FAIL)
    Test the Internet connection using Speedtest.net
    >> Connection error.

    ✅ HTTP proxy environment variables (PASS)
    Detect whether proxy-related environment variables are set (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY, UNITY_PROXYSERVER, UNITY_NOPROXY)
    >> Proxy support has been configured through the following environment variables:
    >> UNITY_NOPROXY = localhost,127.0.0.1

    ✅ UPM health check (PASS)
    Start the UPM process and call its health endpoint
    >> Server start duration: 1078.00 ms
    >> Server response duration: 646.02 ms
    >> Server response:
    >> {"status":"OK","nodeVersion":"v12.2.0","upmVersion":"v3.12.0"}

    hello,

    this is my Unity Package Manager Diagnostics report.

    I've been trying to log into my Unity account through Unity Hub and the Unity Editor, but it won't let me. Sometimes I get a message saying "The server is currently unresponsive" even after I correctly enter my login information on Unity Hub.

    The only way for me to log in is through Chrome, and I can't do much with the editor or hub because it requires you to sign in to those to access assets and such.

    I'm using Unity Hub 2.4.2, Unity Editor 2020.1.1f1 (64-bit), and Windows 10 Home 64-bit.

    thank you!
     
unityunity