Search Unity

DOTS Editor 0.8.0-preview Release: New Entities Window

Discussion in 'Entity Component System' started by raymondyunity, Jun 19, 2020.

  1. raymondyunity

    raymondyunity

    Unity Technologies

    Joined:
    Apr 30, 2018
    Posts:
    122
    We’re now introducing the new Entities window!

    This can be found in the file menu “Window > DOTS > Entities”.


    The new Entities window allows DOTS developers to see their entities in a way much like in the Hierarchy window. One of the main goals of the window is allowing you to establish a contextual connection between Entities and the GameObjects they were converted from.


    You can also now search Entities by component and by name with the filter syntax “c:<component name>”. Just like the Systems window, we have implemented basic search for the MVP and we will add more search features in the future.


    Right now performance is not where we would like it to be but it can handle projects with hundreds of thousands of entities. This is the first iteration of the Entities window so expect more features to come, like connectivity between the Systems and Entities windows.

    Please leave your feedback here and any issues that you may have noticed.

    Cheers!


    Known Issues
    • SubScene loading during runtime will contain entities with no names

    • Duplicating a converted GameObject in playmode does not update the Entities window until it is touched in the Scene view

    • Order is not always the same when comparing Hierarchy and the Entities windows

    • Console warning about USS when installing on 2019.3 or 2019.4

    • SubScene loading and unloading can be unstable at times which will reflect in the Entities window

    • If multiple worlds are present with the same SubScene names there may be unintended SubScene name swapping shown in the Entities window
    Changelog
    [Added]
    • Entities window was added, accessible through Window > DOTS > Entities
    [Fixed]
    • Systems Window: Fixed systems not appearing in non-default world

    • Systems Window: Fixed system name/entityCount/runningTime label misalignment

    • Systems Window: Fixed issue where adding a system in multiple groups would log errors

    • Fixed constant inspector repainting triggered by selecting a non-converted GameObject
    [Changed]
    • Systems Window: The search field is now visible by default and will persist its state across domain reloads

    • Systems Window: Updated disabled systems with "-" instead of 0 for entity matching count and running time

    • Systems Window: The window can now be opened under 'Window > DOTS > Systems' instead of 'Window > DOTS > Systems Schedule'

    • Systems Window: Removed "Show Inactive Systems" option from settings menu so that all systems are shown

    • Updated package com.unity.entities to 0.11.1-preview.4

    • Updated package com.unity.jobs to 0.2.10-preview.12
     
    Last edited: Jun 19, 2020
  2. Wobbers

    Wobbers

    Joined:
    Dec 31, 2017
    Posts:
    55
    Looks cool, but it doesn't work at all in custom worlds for me.
    It requires an EntityHierarchyDiffSystem in the default world, but I have an ICustomBootstrap that moves all default world systems to my client and server worlds, leaving the default world empty except a specified list of systems.
    Since EntityHierarchyDiffSystem is private though, I can't add it to that exclusion list (also its in an editor assembly which I would have to reference in my game assembly definition).
     
    florianhanke likes this.
  3. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    987
    Does this work for entities that are created at runtime?
     
  4. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    987
    It doesn't work with the latest entities :(
    upload_2020-6-19_15-7-7.png
     
  5. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Just update to entities 0.11.1
    Yes, it works with entities, created at runtime.
     
    Razmot and davenirline like this.
  6. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    987
    Oh, I didn't see the .1. My bad.
     
  7. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    New entities window is great. The only request so far is to make the font size the same as in hierarchy window.
     
  8. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    987
    This is great! The bare minimum that I want is to able to select an entity and be highlighted in the scene or the other way around (select in scene and highlighted in entities window). If I need to add a component to enable this functionality, I'd be totally cool with that. I probably don't want all entities to be selectable.
     
    jdtec likes this.
  9. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    My entities are mainly in ServerWorld and ClientWorld0-n, since I am using Unity NetCode. I assume this is the issue for the exception I get when selecting either of these worlds:

    Code (Boo):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Unity.Entities.Editor.EntityHierarchyDiffSystem.Unregister (Unity.Entities.Editor.IEntityHierarchy hierarchy) (at Library/PackageCache/com.unity.dots.editor@0.8.0-preview.1/Editor/EntityHierachy/EntityHierarchyDiffSystem.cs:36)
    3. Unity.Entities.Editor.EntityHierarchyWindow.OnWorldSelected (Unity.Entities.World world) (at Library/PackageCache/com.unity.dots.editor@0.8.0-preview.1/Editor/EntityHierachy/EntityHierarchyWindow.cs:123)
    4. Unity.Entities.Editor.DOTSEditorWindow.OnWorldSelected (UnityEngine.UIElements.DropdownMenuAction action) (at Library/PackageCache/com.unity.dots.editor@0.8.0-preview.1/Editor/Common/DOTSEditorWindow.cs:267)
    5. UnityEngine.UIElements.DropdownMenuAction.Execute () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/DropdownMenu.cs:104)
    6. UnityEditor.UIElements.EditorMenuExtensions+<>c__DisplayClass0_0.<PrepareMenu>b__0 () (at /Users/builduser/buildslave/unity/build/Editor/Mono/UIElements/EditorMenuExtensions.cs:35)
    7. UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[] options, System.Int32 selected) (at /Users/builduser/buildslave/unity/build/Editor/Mono/GUI/GenericMenu.cs:121)

    Any pointers towards fixing this?
     
  10. Zec_

    Zec_

    Joined:
    Feb 9, 2017
    Posts:
    148
    I was having a similar problem @Wobbers . I also manage my worlds with a custom bootstrap, and exclude a most systems out of my default world. To make the new tool work, I fetched the type via reflection and put it in a #if UNITY_EDITOR-segment and included it in the systems list that I inject it into my default world during bootstrap. By doing that, you don't need the reference to the editor-assembly. You can fetch it with something like this:

    Code (CSharp):
    1. #if UNITY_EDITOR
    2. var entityHierarchyDiffSystemType = Type.GetType("Unity.Entities.Editor.EntityHierarchyDiffSystem, Unity.DOTS.Editor");
    3. #endif
     
    Antoine_B likes this.
  11. Zec_

    Zec_

    Joined:
    Feb 9, 2017
    Posts:
    148
    Throwing in a little bug report while I'm at it. Seems like it doesn't handle if an inspected world is destroyed during runtime. When restarting my client and server, I destroy and recreate the whole server/client worlds for simplicity, but keeping the Default World. The EntityDiffer starts throwing these whenever I destroy a world that I currently inspect:
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckWriteAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <fdd4f5823e2a41e8be8d5dcbd0bfd5b1>:0)
    3. Unity.Entities.EntityManager.GetCheckedEntityDataAccess () (at Library/PackageCache/com.unity.entities@0.11.1-preview.4/Unity.Entities/EntityManager.cs:70)
    4. Unity.Entities.EntityManager.GetEntityQueryMask (Unity.Entities.EntityQuery query) (at Library/PackageCache/com.unity.entities@0.11.1-preview.4/Unity.Entities/EntityManagerQuery.cs:90)
    5. Unity.Entities.Editor.EntityDiffer.GetEntityQueryMatchDiffAsync (Unity.Entities.EntityQuery query, Unity.Collections.NativeList`1[T] newEntities, Unity.Collections.NativeList`1[T] missingEntities) (at Library/PackageCache/com.unity.dots.editor@0.8.0-preview.1/Editor/EntityHierachy/DataDiffers/EntityDiffer.cs:31)
    6. Unity.Entities.Editor.EntityHierarchyDiffSystem+Differs.GetDiffSinceLastFrameAsync () (at Library/PackageCache/com.unity.dots.editor@0.8.0-preview.1/Editor/EntityHierachy/EntityHierarchyDiffSystem.cs:166)
    7. Unity.Entities.Editor.EntityHierarchyDiffSystem.OnUpdate () (at Library/PackageCache/com.unity.dots.editor@0.8.0-preview.1/Editor/EntityHierachy/EntityHierarchyDiffSystem.cs:81)
     
    Last edited: Jun 19, 2020
    Antoine_B likes this.
  12. Antoine_B

    Antoine_B

    Unity Technologies

    Joined:
    Jun 26, 2018
    Posts:
    10
    Thank you for your feedback and bug reports.

    Like you noticed this window currently relies on a system that's expected to be be auto registered and scheduled by the default world bootstrapper. Not having this system will at best leave the UI empty and at worst throw null reference exceptions due to this kind of code:
    Code (CSharp):
    1. var system = World.DefaultGameObjectInjectionWorld.GetExistingSystem<EntityHierarchyDiffSystem>();
    2. system.DoRegister(hierarchy);
    We will address the use cases where an ICustomBootstrapper is used and release an update as soon as possible.
     
    Last edited: Jun 19, 2020
    Orimay, Wobbers and Zec_ like this.
  13. Antoine_B

    Antoine_B

    Unity Technologies

    Joined:
    Jun 26, 2018
    Posts:
    10
    In this case the default world bootstrapper is overriden and unfortunately the `EntityHierarchyDiffSystem` is not available on the `World.DefaultGameObjectInjectionWorld` causing a null ref when trying to call a method on it.

    For now this window will not work in this usecase.
     
    florianhanke likes this.
  14. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,271
    Not fixed. Still hitting PlayerLoopSystemGraph.cs line 180:
    Code (CSharp):
    1. UnityEngine.Debug.LogError("System added twice: " + system);
    The problem is you are only accounting for the parent ComponentSystemGroup. However, if a group gets added to multiple groups, then all the systems inside it hits this codepath.
     
    raymondyunity likes this.
  15. Kmsxkuse

    Kmsxkuse

    Joined:
    Feb 15, 2019
    Posts:
    306
    This looks great. I've gotten tired of trying to follow my entities' hierarchy manually by clicking through the entity debugger but I do have several questions:

    Is this just a hierarchy visualization of the entity debugger?

    Where does Entity Window find the information for parent - child relationships on an entity?
    In my custom made entities created at runtime, there are some with parent child connections but they're done so using custom dynamic buffer components and the permanent ones are connected by a blobarray lookup dictionary.

    To that end, what do I need to do in order to configure my custom entities and their components at runtime such that they will show up properly as parent - child foldered entities in this new window?

    Is there any way to sort entities by components / chunks like in the entity debugger?
     
  16. Antoine_B

    Antoine_B

    Unity Technologies

    Joined:
    Jun 26, 2018
    Posts:
    10
    No it's a completely new implementation. Our goal is to replace the entity debugger bit by bit by modular windows.

    Parent/Child information are pulled from the transform parenting for now. Using Parent (IComponentData) and Child (IBufferElementData) and scenes data to wrap all this in Scene/Subscene when present.

    There's no customization possible right now, but we're planning to allow to customize how to group entities, for example by giving you all the tools to build your own "entity hierarchy" state and providing the window with it. But we're still at a early stage for that.

    Grouping is not supported right now. But you can filter entities by components by using this syntax "c:ComponentType". For example if you want to find all entities with the Rotation component just filter by "c:Rotation".
     
  17. Antoine_B

    Antoine_B

    Unity Technologies

    Joined:
    Jun 26, 2018
    Posts:
    10
    Zeffi and yondercode like this.
  18. jdtec

    jdtec

    Joined:
    Oct 25, 2017
    Posts:
    302
    I would also really like this. It seems like an important thing from a usability perspective to me. Do you have plans to do something like this, @Antoine_B?

    If not I will go grab some custom solution soon I suppose.

    Good work so far, looking forward to trying this out now that it supports custom bootstrap.
     
    Last edited: Jul 21, 2020
    davenirline likes this.
  19. Antoine_B

    Antoine_B

    Unity Technologies

    Joined:
    Jun 26, 2018
    Posts:
    10
    For now the only supported workflow we offer between GameObjects and Entities is the "Ping source game object in hierarchy" for entities created from a SubScene. See gif in attachment.

    We don't have short term plan to work on scene integration but it's a feature request we get often so it's something we'll have to address soon.
     

    Attached Files:

  20. jdtec

    jdtec

    Joined:
    Oct 25, 2017
    Posts:
    302
    JesOb and learc83 like this.