Search Unity

Select Entities in Debugger programatically?

Discussion in 'Entity Component System' started by BackgroundMover, Jan 24, 2020.

  1. BackgroundMover

    BackgroundMover

    Joined:
    May 9, 2015
    Posts:
    224
    I'm trying to build a Hierarchy view of entity parents using UIElements Foldout objects. With GameObjects, you can use Selection.activeGameObject = thingToSelect;
    Is theres something similar for entities? I'd like to do it how entities are in the inspector, where a component with an Entity field will have a Select button that jumps over to the Debugger window with the referenced entity selected.
     
  2. martinpa_unity

    martinpa_unity

    Unity Technologies

    Joined:
    Oct 18, 2017
    Posts:
    480
    Everything you would need to do that is internal at the moment and very limited (i.e. you could not do multi-selection).

    We will eventually provide ways to set entity selection/inspection and even have a entity-hierarchy window. This is in our backlog and we hope to start working on those very soon.
     
    optimise and Flipps like this.
  3. RandyBuchholz

    RandyBuchholz

    Joined:
    Sep 23, 2016
    Posts:
    51
    Could you share a little about the direction you are taking on hierarchies? Since there are no "native" hierarchies for entities, and there a few different approaches to implementing hierarchal relationships, I'm guessing you have determined a recommend/best-practices for building hierarchies.

    Native hierarchies would be nice to have instead of storing entity references in other entities. Has something like the way SQL Server HierarchyID works been discussed?
     
  4. BackgroundMover

    BackgroundMover

    Joined:
    May 9, 2015
    Posts:
    224
    Thanks for the clear answer
     
  5. Flipps

    Flipps

    Joined:
    Jul 30, 2019
    Posts:
    51
    The Entity Hierarchy would allow a way better overview when working with gameobjects with alot of childs. Looking forward to it :)
    It would be also nice to mark all Prefab Entities with a special icon infront of the Entity.
     
  6. martinpa_unity

    martinpa_unity

    Unity Technologies

    Joined:
    Oct 18, 2017
    Posts:
    480
    Ideally, what we would want is to have a dedicated window to show entities (calling it a hierarchy might be an abuse of language here) and allow to apply a filter and/or transformation (for ui purposes, no actual changes to the data at this point).

    Examples of filter would be:
    - Apply a query
    - Filter by name
    - Filter by component (differently than using a query)
    - Filter by a originating GameObject
    - Etc.

    Examples of transformations:
    - Grouping by Parent/Child components
    - Grouping by archetypes/chunks/etc.
    - Grouping by SharedComponent value
    - Etc.

    We're aiming for creating a window that would allow to quickly get to the entities that you are interested in. Most of the filters/transformations would be internal at first. But when we are satisfied with how it works, we'll allow extensibility on it.
     
    Flipps likes this.