Search Unity

Is it a good practice to directly access another system?

Discussion in 'Entity Component System' started by Deleted User, Aug 13, 2019.

  1. Deleted User

    Deleted User

    Guest

    There are two ways for systems to communicate (afaik):
    1- System that wants to give the command creates an entity with specific component, then the system who wants to receive the command reacts on that component.
    2- System that wants give the command gets the other system with "GetOrCreateSystem" method. And calls methods on it directly.

    The second way seems a bit off. Since it creates coupling. But I have seen people doing it now and then.
    Is it a good practice?
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,759
    Ideally no as it'd be nice to keep systems decoupled and modular and it leads to the question if a system needs to interact with another system should it just not be 1 system?

    However in practice sometimes it's just the best way but it does often lead to the mess of having to manually handle dependencies.
     
    Deleted User likes this.