Search Unity

Editor Tool for Entities and Systems

Discussion in 'Entity Component System' started by dstilwagen, Nov 14, 2018.

  1. dstilwagen

    dstilwagen

    Joined:
    Mar 14, 2018
    Posts:
    36
    I created this tool to allow adding/removing and editing components to entities, along with creating entities with components attached all while the player running. It also allows systems to be created, disposed and updated for each world without having to stop and restart the player.

    Editor Tool for Entities and Systems: https://gitlab.com/unity3d-tools/ecs-tools
    Code (csharp):
    1. Entity and System Tool
    2. This tool is to be used with Unity3D's Entity Component System (ECS). Currently there is only one editor window with two pages, one for systems and one for entities. In the near future they will be moved into their own editor windows.
    3.  
    4. Systems Page
    5. Each world is listed with all the systems available in the current assembly. The system list is obtained using the same method that is used in default initialization.Note 1 If a system exists for a world it is listed first and, systems that don't exist are listed after. Each can be updated, disposed, and recreated independently of each other.
    6.  
    7. World
    8. World's do not currently have any functionality exposed in the UI.Note 2
    9.  
    10. System
    11. Each system has the following functions available in the UI.
    12.  
    13.  
    14. Create: Creates the system in the world it is listed under.
    15.  
    16. Update: Calls Update() for the system in the world it is listed for. This does not bypass the internal checks used to determine if a system should run or not.
    17.  
    18. Dispose: Calls Dispose() for the system in the world it is listed for.
    19.  
    20.  
    21. Entities Page
    22. The Entities Page is split into two panels, the Components Panel is on the left and the Entities Panel is on the right.
    23.  
    24. Components Panel
    25. This is a list of all components available in the TypeManager. Components are sorted into 6 categories Shared, Shared System State, System State, Tag or Zero Sized, Buffer Array,Note 3 and Components (IComponentData). Any component that implements multiple interfaces will be listed in multiple categories.Note 4
    26.  
    27. Entities Panel
    28. This is a list of all entities in the selected world. Entities are listed in the same order as clicking EntityManager in the Entity Debugger window and it shows the same readonly inspector when an entity is clicked. Using the foldout arrow displays a list of the components attached to that entity. Selecting a component will display editors the same way as selecting it in the components panel. Components don't automatically update. To update a component you must use the Set Component button along the bottom.Note 5
    29.  
    30. Editing Components
    31. There are currently two different ways to edit a component. Selecting a component displays editors for that component's fields in the bottom panel. Clicking the foldout arrow displays a list of editors for that components fields. Currently this only supports the different int and float types from Unity.Mathematics, and primitive types. Note 6
    32.  
    33. Entity Manager Functions
    34. The entity used for these functions is the entity shown in the inspector or it defaults to the last selected entity from any Entities panel. This allows you to select an entity from the Entity Debugger and use it.
    35.  
    36.  
    37. Add Component => Adds the selected component to the selected entity.
    38.  
    39. Set Component => Sets the selected component on the selected entity.
    40.  
    41. Remove Component => Removes the selected component from the selected entity.
    42.  
    43. Destroy Entity => Destroys the selected entity;
    44.  
    45. Create Entity With Components => Creates an entity with the selected components from the components panel.Note 7
    46.  
    47.  
    48.  
    49. Notes:Limitations and plans for the future.
    50.  
    51. Note 1: There is limited support for systems that have a generic type as part of the class definition. The class will only display if it is part of the player loop. They can still be updated and disposed, but not created from the editor window.
    52. Note 2: An update all systems and dispose are currently planned for the near future.
    53. Note 3: Buffer Array Components are not supported yet.
    54. Note 4: An option to change this maybe added later.
    55. Note 5: The plan is to make this set uneeded and automatically update the component.
    56. Note 6: I'm looking for a better way of displaying editors other than manually checking the type and displaying an editor.
    57. Note 7: Multi-Select is current disabled but it is planned for in the future.
    ECS Tools Sample Project: https://gitlab.com/unity3d-tools/ecs-tools-sample
    Code (csharp):
    1.  
    2. ECS Tools Sample Project
    3. A sample project with a collection of tools to be used with Unity's Entity Component System (ECS).
    4. List of tools:
    5. Entity and System Tool: An editor window with two pages, a systems and an entities page, see the associated Readme.md for more details.Note 1
    6. Notes:Limitations and plans for the future.
    7. Note 1: This will likely be split into different editor windows as each page gains more functionality.

    This is my first attempt at making a custom editor window. Any feedback positive, negative, or any suggestions for improvements and/or new features would be appreciated.

    Attached is a Unity Package, I haven't decided where I will put future version release so for now I will attach them here.
     

    Attached Files:

  2. Orimay

    Orimay

    Joined:
    Nov 16, 2012
    Posts:
    304
    Sounds very interesting! Can't look at it right away, so screenshots are my desire. They could complete your repository
     
    e199 likes this.