Search Unity

How to prevent systems from updating multiple times at start

Discussion in 'Entity Component System' started by Abbrew, Feb 14, 2019.

  1. Abbrew

    Abbrew

    Joined:
    Jan 1, 2018
    Posts:
    417

    At startup PlayerLoop is called multiple times, and Systems are called multiple times as well. This makes it hard to deduce the latency of systems. Is there a way to prevent multiple updates, or figure out the running time of systems?
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,780
    Is the any reason, why you are concerned about startup delay? Your more important is system runtime, when game is already running.

    Maind, You may be needles needing check / profile in built, rather in editor.
     
    Last edited: Feb 15, 2019
  3. Abbrew

    Abbrew

    Joined:
    Jan 1, 2018
    Posts:
    417
    I have a monobehaviour that tests the system in the Start() function, but now that you've mentioned it it might be better to have a coroutine that waits a second or two before executing the test. Or maybe I should just write editor-mode unit tests.
     
  4. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,780
    However, ECS systems run independently from MonoBehaviour. Unless you trigger it there.
    If you want profile / test system, you would be better do it in corresponding system.
     
  5. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    I can't replicate this.

    My systems only update once during the initial player loop update.

    upload_2019-2-16_8-13-46.png

    It seems like only the MonoBehaviour loop gets called multiple times.