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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

WaitForCompletion freezes on second run of android build

Discussion in 'Addressables' started by jonkelling, Mar 15, 2022.

  1. jonkelling

    jonkelling

    Joined:
    Dec 18, 2019
    Posts:
    21
    Calling
    WaitForCompletion()
    will block indefinitely only on and after the second run of an android build. I can't tell if this is a known issue? I'm about to start reworking my code to work around the problem. Probably using Coroutines and callbacks, but I'm not thrilled about it. Anyone else run into this? I'm calling it from the OnEnabled of a MonoBehaviour that's in the startup scene of my project.
     
  2. jonkelling

    jonkelling

    Joined:
    Dec 18, 2019
    Posts:
    21
    Update: I added a delay, with a bit of success. i.e.:
    Code (CSharp):
    1. public void OnEnable()
    2. {
    3.     StartCoroutine(DoInit());
    4. }
    5.  
    6. private IEnumerator DoInit() {
    7.     yield return new WaitForSeconds(2f);
    8.     ......WaitForCompletion();
    9. }
    So, it works with a 2 second delay. I tried
    WaitForSeconds(0.1f)
    and it wasn't enough (still locked up).