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.

Unity Multiplayer 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:
    55
    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,633
    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:
    55
    Ah I see.
    Thank you