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

ECS editor tools flow

Discussion in 'Entity Component System' started by snacktime, Dec 12, 2019.

  1. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    I think it would be really useful for Unity to provide a proper system for managing this.

    This is what I ended up with.
    https://gist.github.com/gamemachine/054b6087154214a9742514165fca961e

    The problem I have with this solution is first having to wrap worlds. But if you want a seemless solution you have to in some fashion. Second it all breaks down once you factor in third party assets. You need a one true way to handle this or it's just not going to work once you mix third party stuff with your own game.

    Even basic built in support would be great. Handling state changes on this, it seems like there should just be one right way so could be generalized and made internal. And then have some sort of callbacks where we can respond with what systems to create and if they should get put into the player loop. And that's done for us. We then take it from there and do additional feature specific setup/teardowns.
     
  2. KjartanK_Unity

    KjartanK_Unity

    Unity Technologies

    Joined:
    Apr 2, 2018
    Posts:
    4
    Can you expand a bit on what you're looking to do with this? By "ECS Editor Tools Flow" are you talking about a way to create Editor tools using ECS?
     
  3. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    I'm talking about general tooling integration where you need to have systems running in editor mode. And also where you might want to cycle creating/destroying entities or starting/stopping systems.

    The specific challenges might not be obvious to those that haven't dealt with it directly. But even the ECS source where it initializes worlds comments about how crazy some of the flow is, they even document your own startup sequence inline.

    Specific example, I took a navigation system I was going to open source as an opportunity to work through this. I have an ECS system that manages a number of 'sub systems' representing surfaces. I needed to be able to start/stop those on demand in the editor. I also needed needed our Unity.Physics systems to be running so I could load colliders that feed the nav building, as the building process itself works by IJobForEach jobs that collect Unity.Physics colliders. And I needed to be able to tear it all down also, to reset the state.

    And on top of that it has to seemlessly transition from edit to play mode and back.


    I used a cheap trick to run systems instead of the player loop.

    But the larger point is factor in asset authors and there is absolutely no way to do this correctly without more built in support. There needs to be a built in one right way for a game and assets to be able to specifiy what is running without stepping all over each other.
     
  4. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,081
    We also need this stuff to be core foundation of Unity DOTS