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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Resolved Run stuff on system but ALSO do a Entities.ForEach

Discussion in 'Entity Component System' started by Guedez, Jul 24, 2020.

  1. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    825
    I have this one big system that do a whole lot of stuff, and I needed to add a
    Entities.ForEach
    to it. Now the whole system will only ever run when
    Entities.ForEach
    have something to work on. How can I make the system runs every frame regardless of having or not something to process on
    Entities.ForEach
    ?

    I will not split in two systems unless it's the absolute only way to do it. I like the way I have total control over when/if I call
    JobHandle.Complete
    for my
    Entities.ForEach
    as it currently is.
     
  2. BanJaxe

    BanJaxe

    Joined:
    Nov 20, 2017
    Posts:
    47
    Use the AlwaysUpdateSystem attribute.

    Code (CSharp):
    1.     [AlwaysUpdateSystem]
    2.     public class SystemName : ComponentSystem { ... }
     
    Guedez likes this.
  3. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    825
    Worked like a charm.