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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Updating World at a different rate

Discussion in 'Entity Component System' started by Xerioz, Jul 13, 2018.

  1. Xerioz

    Xerioz

    Joined:
    Aug 13, 2013
    Posts:
    104
    Haven't found any ways to do. Most solutions involve updating manually each system, but why can't the world simply update them all in one go?

    My use case is simple: I have a simulation loop running at a fixed interval.

    I'm currently going around this problem by doing this before every OnUpdate():
    Code (CSharp):
    1.             time += Time.deltaTime;
    2.             if (time < DefaultUpdate.TIME_INTERVAL) return;
    3.             time = 0f;
    Any other way to do this?
     
  2. Enrico-Monese

    Enrico-Monese

    Joined:
    Dec 18, 2015
    Posts:
    77
    You could create a different world and manage that yourself how you want it. Or disable the automatic bootstrap of the default world and make that work how you want it.
    The default script is a "one fits all" solution, you can get the script from the entities package folder I think and modify that probably. Something along those lines I think
     
  3. Xerioz

    Xerioz

    Joined:
    Aug 13, 2013
    Posts:
    104
    That's exactly my issue. How do I create a separate World and update it manually, while still maintaining the magical update order (e.g. UpdateAfter/Before )?
     
  4. Enrico-Monese

    Enrico-Monese

    Joined:
    Dec 18, 2015
    Posts:
    77
  5. Xerioz

    Xerioz

    Joined:
    Aug 13, 2013
    Posts:
    104
    Yeah, well, ScriptBehaviourUpdateOrder.UpdatePlayerLoop is the only way to make them tick while doing its update order magic, but that hooks up to one of the update loops ( update, fixed update ).

    Wish there was more info on this subject :(

    Do we really have to wait for their FPS networking demo to see how they implemented independent world updates?
     
  6. zyc_dc

    zyc_dc

    Joined:
    May 11, 2018
    Posts:
    42
    I got the same issue. Really want to update a world manually and keep the update order.