Search Unity

Nested systems

Discussion in 'Entity Component System' started by hottabych, Feb 2, 2020.

  1. hottabych

    hottabych

    Joined:
    Apr 18, 2015
    Posts:
    107
    I want an ability to nest game mechanics into 1 game component and to turn on and off. Because having a hundred tightly coupled components on complicated character is inconvenient and not flexible.
    Like here
    - a lot of components "3rd person input", "effects", "inventory", "sounds", "alerts", "health", "platform" etc etc... and inspector is overflown with components, and setup is way too complicated.
    For instance, I have a character who can run, shoot, jump and roll. I have one script "Character Controller" on it with nested systems/mechanics "run", "shoot", "jump", "roll", independent from each other. If i turn off "shoot", he cannot shoot but still can do other moves. Or I can insert another implementation of shooting... or throw grenades instead.
    Something similar done here, that's what I like (but here guy created his own implementation of ECS and own custom editor):

    I'm not sure if it should be posted in DOTS topic, if I'm wrong please move it to another place.
     
  2. eterlan

    eterlan

    Joined:
    Sep 29, 2018
    Posts:
    177
    If I remember correctly, you can disable whatever system you like in the entity debugger. If you want to disable many systems at once, you might create a system group for those related systems, and turn them off by one click.
    If I'm wrong, the only way seems to hard code it.
    You can't put a system script on an prefab or gameobject if that's what you want to do.