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. Dismiss Notice

Question What difference between these two performance of type

Discussion in 'Entity Component System' started by SlumberPenguin, Sep 23, 2023.

  1. SlumberPenguin

    SlumberPenguin

    Joined:
    Sep 20, 2020
    Posts:
    25
  2. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    274
    The second one needs a nested query, which is only supported through SystemAPI.Query, you cannot do this in a job. This executes on the main thread. The first one runs as a job, potentially on a background thread.
     
  3. Laicasaane

    Laicasaane

    Joined:
    Apr 15, 2015
    Posts:
    288
    This example provides its code in 5 steps so that you can gradually learn how to code in ECS, how to optimize your code.

    upload_2023-9-23_12-48-58.png

    Because it has the old version as well as the new version, you can compare the differences and learn from them.
     
    Last edited: Sep 23, 2023