Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

What is ScheduleUpdate().Complete() doing for me here?

Discussion in 'Multiplayer' started by bibbis, Mar 16, 2020.

  1. bibbis

    bibbis

    Joined:
    Dec 5, 2016
    Posts:
    58
    Hi,
    I'm digging into the Unity Transport preview package and following the example in the manual here:
    https://docs.unity3d.com/Packages/c...orkflow-client-server.html#server-update-loop

    I'm confused about the usage of: m_Driver.ScheduleUpdate().Complete();
    It says that we have to "make sure to call the Complete method on the JobHandle that is returned, in order to know when you are ready to process any updates."
    How does calling this function allow me to know if the job is complete?

    If I was instead doing this:
    if (m_Driver.ScheduleUpdate().IsCompleted)
    {
    }
    Then yeah, it would make perfect sense, but as it stands right now it just doesn't make any sense to me.
     
  2. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Calling Complete() on the JobHandle will block the main thread until the job completes.
     
    bibbis likes this.
  3. bibbis

    bibbis

    Joined:
    Dec 5, 2016
    Posts:
    58
    Ah I see.
    Thank you