Selecting a specific entity to inspect in the inspector

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?

1 Like

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.

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.

I would also like this API to be public again.
We’re using it for the exact same purpose scottjdaley describes.