Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Any idea why we would be seeing an object Awake called twice on reload (2022.2.3f1)

Discussion in 'Web' started by fwalker, Feb 24, 2023.

  1. fwalker

    fwalker

    Joined:
    Feb 5, 2013
    Posts:
    255
    When we first run the application on WebGL a gameObject's Awake function gets called once as expected. (Just like it does on the Editor)
    Then if we refresh (Chrome) the game runs again and our gameObjects Awake function gets called twice!!

    We cant repo this on Unity Editor (obviously) since there is no refresh.

    And we are at a loss at figuring this one out.

    Does anyone have any ideas of what this might be about Unity 2022.2.3f1
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,382
    How do you determine that it runs twice? How do you perform the refresh? There's the F5 and then there's Ctrl+F5. Try both, and different browsers. And double-check (ie via timestamps) that you aren't misreading the logs or the behaviour you see ingame. It could be as simple as manually calling Awake() under some circumstances (I've seen devs do that!).

    If it reliably occurs in other browsers, it's prone to be an issue with the app itself, so be sure to test other browsers.
    But if it only happens in Chrome, it might have to do with Chrome itself or an extension. Be sure to test with a fresh install of Chrome with no additional plugins/extensions installed.