Entity and System Tool
A tool to be used with Unity3D's Entity Component System (ECS) or it's new name Data-Oriented Tech Stack (DOTS). 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.
Systems Page
The systems page is split in a top and bottom panel. The top panel is a list of all systems available in the current assembly and the option to create a system into a selected world. The system list is obtained using the same method that is used in default initialization.Note 1 The bottom panel is a list of each world and the systems for that world which can be updated, disposed.
World
World's do not currently have any functionality exposed in the UI.Note 2
Fuctions now available for each world.
- Update All: Updates all the systems for the associated world in the order they appear.
- Update Selected: Updates selected systems for the associated world in the order they appear.
- Update PlayerLoop: Update the PlayerLoop for the associated world.
- Dispose: Dispose of the associated world.
System Functions
Each system in the top panel has the following functions and options available.
- World Selector: Allows you to select the world to create the system in.
- Create: Creates the system in the world it is listed under.
Each system in the bottom panel has the following functions and options available
- Enabled: Away to quickly enable or disable a system.
-
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. -
Dispose: Calls
Dispose()
for the system in the world it is listed for.
Entities Page
The Entities Page is split into two panels, the Components Panel is on the left and the Entities Panel is on the right.
Components Panel
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
Entities Panel
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
Editing Components
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
Entity Manager Functions
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.
- Add Component => Adds the selected component to the selected entity.
- Set Component => Sets the selected component on the selected entity.
- Remove Component => Removes the selected component from the selected entity.
- Destroy Entity => Destroys the selected entity;
- Create Entity With Components => Creates an entity with the selected components from the components panel.Note 7
Limitations and plans for the future.
Notes: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.
Note 2: An update all systems and dispose are currently planned for the near future. Added Functions see World section.
Note 3: Buffer Array Components are not supported yet.
Note 4: An option to change this maybe added later.
Note 5: The plan is to make this set uneeded and automatically update the component.
Note 6: I'm looking for a better way of displaying editors other than manually checking the type and displaying an editor.
Note 7: Multi-Select is current disabled but it is planned for in the future.