Search Unity

Resolved Selecting a specific entity to inspect in the inspector

Discussion in 'DOTS Dev Blitz Day 2022 - Q&A' started by Rupture13, Dec 8, 2022.

  1. Rupture13

    Rupture13

    Joined:
    Apr 12, 2016
    Posts:
    130
    To debug my game, I often have to look up an entity via the DOTS specific windows to inspect its data in the inspector. I regularly have to look up the same entity over multiple runs. This means I have to spend time searching for the right entity again and again. It would be helpful if I could sort of "cache" my search to easily select the entity I'm interested in.

    This could be possible if there were a way to cache searches (similar to how you can save searches in the project window) inside the DOTS hierarchy window.

    Alternatively, I could write my own buttons to select specific entities, but I'd need to have access to some public API for selecting the entity to be shown in the inspector. Does that exist currently or will it exist in the future?
     
    JesOb likes this.
  2. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    As far as I could tell, there is no public API for this currently.

    It is possible to do this using
    Selection.activeObject
    and
    EntitySelectionProxyUtility.GetAuthoringObjectForEntity
    . However, unfortunately the latter API is not public, so you will have to either edit the Entities package source and make it public, or access the method via reflection. The return value of this method should be assignable to
    Selection.activeObject
    .

    I will try to raise this point internally, so that we could provide a public API for this purpose in the future.
     
  3. scottjdaley

    scottjdaley

    Joined:
    Aug 1, 2013
    Posts:
    163
    FWIW, this used to be possible in an older version of ECS and was quite handy when there was no scene picking support. But even now, I think this would be useful as a public API. For example, I'm making a grid-based game and it would be nice to be able to open the inspector for the hovered entity while in the game view.
     
  4. Sebioff

    Sebioff

    Joined:
    Dec 22, 2013
    Posts:
    218
    I would also like this API to be public again.
    We're using it for the exact same purpose scottjdaley describes.