Accessing to entities windows

In my system GitHub - Antoshidza/NSprites: Unity DOTS Sprite Rendering Package I want to debug users entity composition and inform him if system detect any issues. To do so I validate EntityArchetype, then I pring issue report as Debug.LogError.

The problem is I can’t refer problematic EntityArchetype more handy than just printing it’s hex hash, so user than should go Window → Entities → Archetypes and find manually or user search bar, so he could inspect archetype which my system described as problematic. This is already possible to rapidly copy past hash and inspect archetype, yes, we can end right here. But I want to make it a little bit handy: open / get new Archetypes window and fill search bar. The latter I believe can be done by accessing window’s root element and just searching for search element by name we can know by debugging UI in editor. Though I can’t access most unity built-in windows.

Please, let us at least control windows’s selection / search bars / etc, all things which can only be touched by user’s input.
If anybody knows smart way of accessing built-in window please let me know :slight_smile:

It’s pretty simple, you just get assembly where it lies and get ArchetypesWindow class by it’s name. As far as you have required type you can do whatever you want - show window, get uxml DOM and query/modify elements etc.
8885175--1214442--upload_2023-3-18_14-23-46.png

[MenuItem("DNO/Archetypes")]
public static void ArchetypesWindowGetter()
{
    var archetypesWindowType = typeof(Unity.Entities.Editor.ExtraTypesProvider).Assembly.GetType("Unity.Entities.Editor.ArchetypesWindow");
    var archetypesWindow = EditorWindow.GetWindow(archetypesWindowType);
    var searchInput = archetypesWindow.rootVisualElement.Q<TextField>(name: "search-element-text-field-search-string");
    searchInput.value = "My search string value";
}

8885175--1214439--upload_2023-3-18_14-23-39.png

1 Like

ExtraTypesProvider is private as any type else in it’s assembly, so I guess I should access to assembly different way, maybe just filtering all assemblies by name

Ah they’ve hide many types in 1.0 (we’re on 0.51)

1 Like