Assembly Definition Editor & the new Searcher

Well, creating an Asmdef for my Unity ECS baking components was a colossal waste of time and an excercise in futility.

That part of the tooling needs an immediate overhaul.

Sorry to play the annoyed asshole here again, but that’s not a DX that I expect from a mature product like Unity.

Here’s my developer experience for the night:

  • you can’t multi-drag Assembly Definition References
  • you can’t even single drag-add them (other lists allow you to drag an item to its top, bottom, or sometimes between elements, but here, you have to first create an empty one and then fill it)
  • you can’t sort the entries
  • you can’t automatically remove duplicates
  • you can’t autodetect needed dependencies (seriously, by default, a new asmdef asset should be populated with all the previous references the code it covers uses)
  • compiler errors are shortened to the point of being useless, (if they don’t stop coming/changing altogether)
  • good luck figuring out which of the three or four candidate assemblies will resolve the compile issues; massively exacerbated by ECS’ very generous helping of extra many assemblies.
    - the new searcher shows nothing but useless garbage when trying to pick asmdefs
  • in safe mode, you get even less info, so you better hope you don’t have to shut down the editor half way (spoiler alert, you do the compiler gets stuck, especially codegen and burst, but also something called “Waiting for Scriptupdater” just hangs)
  • safe mode has no Focused Inspector (huh?!), so back to Locked Inspector workflow like it’s 2010 (circa, colorized)
  • with many more packages in the average unity project, this workflow suffers quadratic complexity and effort the more complex it gets.
  • with the out of box workflow, some things just can’t be done, including for example creating an asmdef that contains code referencing URP or HDRP.


“Hmm, are those enough assemblies, or did I forget one?”

Suggestions, any of these would be celebrated by the users:

PLEASE provide single entry point assemblies, e.g. Unity.Entities for ALL ECS packages that are currently installed.

PLEASE Create a sample asmdef import for EVERY package, so one can quickly copy that. Make GUID entries copy/pasteable, so one can take them from the template.

PLEASE Allow the use of literal strings again - that feature is gone now, even though the checkbox still exists.


Checkbox “use GUIDs” is off, still guid based asmdef asset links, the editable string lists of the past have been taken away now it seems. Editing YAML is no longer an option, because this is what it looks like now…


no longer human readable, finally an excuse to turn on binary asset serialization again…

PLEASE Allow the use of WILDCARDS - e.g. Unity., Tiger.Editor., MongoDB.BSON.*

PLEASE show the assembly name and root namespace in the searcher. (and please fix it, see below)

PLEASE auto-populate new Asmdef assets with all referenced assemblies (if impossible, it would even help to just have one with ALL Assemblies, and then one can prune manually)

Alternatively, PLEASE make all Unity.* packages automatically part of the “Engine References” packages. It would cut asmdef editing needs easily by 85%. This specifically includes URP, DOTS, et. al.

PLEASE Allow us to place Asmdefs in that editor via drag & drop (seriously, most other lists do this, but in this inspector, of all places, you simply omitted it? Only after adding the new Searcher, of course, which makes search even harder.)

… any one of these suggestions would make asmdef inspector at least remotely useful again.

But, oh, that wonderful, now no longer optional searcher:
(that finds nothing useful, ever)
This searcher one get when clicking on the object selector in the Asmdef inspector must be some kind of joke, it can’t even seach in packages and it very skillfully obfuscates the actual assembly names. But at least it tells us the file name twice!


It also can’t find any Engine or Package assemblies.
It also can’t find any Engine or Package assemblies.
It also can’t find any Engine or Package assemblies.

Out of the box, most unity projects and templates contain about a dozen core packages. This is a serious defect and makes asmdef creation an Impossible task. There are workarounds, but they are adding several extra clicks to each step of an already unbearable workflow.

It also can’t preview or inspect asmdefs, so you have to guess what’s inside (e.g. conditionals, platform flags, etc.). Better keep a list on paper to check which ones you already added only to find out they’re not the ones you wanted.

To add injury to insult, it will also INSTANTLY overwrite the object field you clicked the Circle icon on, so while scrolling through the list, be careful not to ever click INTO the list. Undo is unreliable here, by the way.

Yeah, I’m done for the day. It has only, oh, minus 24 minutes left, anyway.

2 Likes

Your dependencies list is staggering. I’ve never seen so many in a single assembly def. You sure you need all of these?

Ah yes, you definitely can sort dependencies. I do it all the time because I like them sorted by category or name. Just drag that “double-dash” handle on the left side of a dependency.

Really great and useful IDEs do that. Hint: it’s not Visual Studio. Visual Studio is for dummies. :stuck_out_tongue:

Also, really great and useful IDEs show you the name of the assembly next to the GUID. Just sayin’ …

But I do share your pains regarding the “New Search” tool. I tried it out just yesterday, and I wrongfully believed this should be a feature you can get around with without using the Manual. But no, even with the Manual it’s just super-odd. Like I only wanted it to search for items in the selected folder and it would always show me everything. I guess “search in project” overrides any directory filter or something. At the end of the day I went back to the old picker windows, not great either but at least I understand how they work and a string filter is more than enough most of the time.

  1. Ah, by “sort” I mean automatic, not manual bubble sort. :slight_smile: I’m already clicking around there enough as it is. Also, just remove duplicates automatically if they’re an error?

  2. Yes, unfortunately, Unity isn’t a great IDE either, and the .asmdef asset type is a Unity proprietary thing.

It’d be great if I could just let Rider or something configure a project cleanly; into a .csproj and .sln or whatever (that is then PART of the project, not an artifact of the project), with build targets and configurations and stuff. Instead, Unity gave us SBP, and still can’t automatically increment build numbers or package certain assets for certain build targets (or at least platforms!), and other assets for others. But that is super offtopic. But I’m still scratching my head how that hasn’t been done in AssetPipeline V2 yet, and how nobody has been muttering even the word AssetPipeline V3 yet. I mean you can’t even INJECT any values (it would be a start to have non-boolean defines!) into the build process without creating an asset at build time (there should be a key-value store, which is available like PlayerPrefs in the build, but which is populated AT build, or PER target, and not from C# code.

I’d also like Unity to separate Asset and Script Asset imports; and Compilation should be possible without a Domain Reload (that can come on demand, like Asset Refresh or before entering PlayMode) - so IDEs like Rider can recompile (and codegen!!!) without having to wait for a 20-35 second Domain reload with a medium size DOTS project on every source file change.

Domain Reload in general needs to go away, period. I’d prefer to see Burst killed if that meant we could have .NET 6 or 7 now, with AoT compilation for builds instead of whatever IL2CPP is supposed to be anymore.

So it can be TOLD to look in packages; which at least makes it not fundamentally broken (but I think only after building a custom packages Index, and it also crashed the first time). OOBE is still awful either way.

This also doesn’t fix the workflow problem, or that it overwrites or doesn’t let me drag & drop from this window into a list. And if you double click, it closes the search and then updates the inspector - it could do that on focus.

Or that it doesn’t show the right attributes here - it absolutely MUST show the assembly name, and ideally also the root namespace, in ADDITION to the asset path.

There is an option to copy a GUID for an object in search! There is hope!

Oh wait. On multi-select, this option is hidden. Of course. Why would you make an information available once, but not for any multiples?

Otherwise, it would be possible to hand-edit .asmdef files… but perhaps Unity indeed want to go back to binary asset serialization soon?

There isn’t even a way to “SELECT ALL” in a search, I would expect CTRL-A to work here, or it being a standalone, customizable shortcut.

9181862--1279115--upload_2023-7-30_17-20-57.png

Speaking of shortcuts, what the hell are these hard coded things doing overriding my shortcuts? (actually they don’t, my existing shortcuts more or less interfere with these)

I also made Tab my Transient Search Window key, fortunately the hard-coded “Press Tab to Filter” function of the transient window doesn’t collide with that. (my other thread on Shortcuts would have me thinking it absolutely would)

EDIT: Oh I was wrong, I mean, I was right. In a Non-Transient Window, but only if it is Docked, then a new window will open. :frowning:


The “cannot drag things into lists additively” thing seems to be a new Unity staple, it also doesn’t work here (trying to drag a folder into the list)

At least Search keeps the same standard as all IMGUI stuff, which means it slowly rots while UIElements can’t even replace half of it.

This does sound pretty damning, … but sorry, not sorry - this is the 2022.3 LTS version of Unity here, in its mature, yet youthful, 5th patch release, no less.

That’s not a bug that should even be in there, as it would be easily found by automated tests, or even manual smoke tests. (just search on any medium sized project)

Console Log

Unable to use a named GUIStyle without a current skin. Most likely you need to move your GUIStyle initialization code to OnGUI
0x00007ff6d3138e4d (Unity) StackWalker::GetCurrentCallstack
0x00007ff6d313ddf9 (Unity) StackWalker::ShowCallstack
0x00007ff6d410b121 (Unity) GetStacktrace
0x00007ff6d47cd922 (Unity) DebugStringToFile
0x00007ff6d20897f6 (Unity) DebugLogHandler_CUSTOM_Internal_Log
0x0000023866e5b20a (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
0x0000023866e5b07b (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[ ])
0x0000023866e5a4fe (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object)
0x0000023866e5a19a (Mono JIT Code) UnityEngine.Debug:LogError (object)
0x0000023866e59f4b (Mono JIT Code) UnityEngine.GUIStyle:hushed:p_Implicit (string)
0x0000023866e58f03 (Mono JIT Code) UnityEditor.Search.SearchSettings/Styles:.cctor ()
0x000002386c58ef95 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
0x00007ffd2286e0d4 (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445)
0x00007ffd227aeb74 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3066)
0x00007ffd227a9c20 (mono-2.0-bdwgc) mono_runtime_class_init_full (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:563)
0x00007ffd227b02c5 (mono-2.0-bdwgc) mono_field_get_value_object_checked (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3695)
0x00007ffd22712319 (mono-2.0-bdwgc) ves_icall_RuntimeFieldInfo_GetValueInternal_raw (at C:/build/output/Unity-Technologies/mono/mono/metadata/icall-def.h:705)
0x000002386c51b584 (Mono JIT Code) (wrapper managed-to-native) System.Reflection.RuntimeFieldInfo:GetValueInternal (System.Reflection.RuntimeFieldInfo,object)
0x000002386c51abcb (Mono JIT Code) System.Reflection.RuntimeFieldInfo:GetValue (object)
0x0000023866e34697 (Mono JIT Code) UnityEditor.SettingsProvider/<>c__651<T_REF>:<GetSearchKeywordsFromGUIContentProperties>b__65_1 (System.Reflection.FieldInfo) 0x00000236ee65e0ed (Mono JIT Code) System.Linq.Enumerable/WhereSelectArrayIterator2<TSource_REF, TResult_REF>:MoveNext ()
0x000002386c5c01b5 (Mono JIT Code) System.Linq.Enumerable/ConcatIterator1<TSource_REF>:MoveNext () 0x0000023866e3436b (Mono JIT Code) System.Linq.Enumerable/WhereSelectEnumerableIterator2<TSource_REF, TResult_REF>:MoveNext ()
0x00000236ee65d98d (Mono JIT Code) System.Linq.Enumerable/DistinctIterator1<TSource_REF>:MoveNext () 0x000002386c5c01b5 (Mono JIT Code) System.Linq.Enumerable/ConcatIterator1<TSource_REF>:MoveNext ()
0x00000236ee62382f (Mono JIT Code) System.Collections.Generic.HashSet1<T_REF>:UnionWith (System.Collections.Generic.IEnumerable1<T_REF>)
0x00000236ee622e13 (Mono JIT Code) System.Collections.Generic.HashSet1<T_REF>:.ctor (System.Collections.Generic.IEnumerable1<T_REF>,System.Collections.Generic.IEqualityComparer1<T_REF>) 0x00000236ee6229bb (Mono JIT Code) System.Collections.Generic.HashSet1<T_REF>:.ctor (System.Collections.Generic.IEnumerable1<T_REF>) 0x0000023866e39743 (Mono JIT Code) UnityEditor.SettingsProvider:set_keywords (System.Collections.Generic.IEnumerable1)
0x0000023866e577fb (Mono JIT Code) UnityEditor.Search.SearchSettings:CreateSearchSettings ()
0x0000023866dbaa6c (Mono JIT Code) UnityEditor.SettingsService/<>c:b__16_0 (UnityEditor.AttributeHelper/MethodWithAttribute)
0x0000023866db9f95 (Mono JIT Code) System.Linq.Enumerable/SelectListIterator2<UnityEditor.AttributeHelper/MethodWithAttribute, UnityEditor.SettingsProvider>:MoveNext () 0x000002386c5c01b5 (Mono JIT Code) System.Linq.Enumerable/ConcatIterator1<TSource_REF>:MoveNext ()
0x00000238668b5943 (Mono JIT Code) System.Linq.Enumerable/WhereEnumerableIterator1<TSource_REF>:MoveNext () 0x0000023866db8f83 (Mono JIT Code) UnityEditor.SettingsService/<FilterAndWarnAgainstDuplicates>d__7:MoveNext () 0x0000023866db8f83 (Mono JIT Code) UnityEditor.SettingsService/<FilterAndWarnAgainstDuplicates>d__7:MoveNext () 0x000002386674e276 (Mono JIT Code) System.Collections.Generic.LargeArrayBuilder1<T_REF>:AddRange (System.Collections.Generic.IEnumerable1<T_REF>) 0x000002386c5b40d3 (Mono JIT Code) System.Collections.Generic.EnumerableHelpers:ToArray<T_REF> (System.Collections.Generic.IEnumerable1<T_REF>)
0x000002386c5b3c23 (Mono JIT Code) System.Linq.Enumerable:ToArray<TSource_REF> (System.Collections.Generic.IEnumerable1<TSource_REF>) 0x0000023866db54bb (Mono JIT Code) UnityEditor.SettingsService:FetchSettingsProviders () 0x0000023866db4e13 (Mono JIT Code) UnityEditor.Search.Utils:FetchSettingsProviders () 0x0000023866db4cc3 (Mono JIT Code) UnityEditor.Search.Providers.Settings/SettingsProviderCache:FetchSettingsProviders () 0x0000023866db2e5b (Mono JIT Code) UnityEditor.Search.Providers.Settings/SettingsProviderCache:.cctor () 0x000002386c58ef95 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr) 0x00007ffd2286e0d4 (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445) 0x00007ffd227aeb74 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3066) 0x00007ffd227a9c20 (mono-2.0-bdwgc) mono_runtime_class_init_full (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:563) 0x00007ffd228f8979 (mono-2.0-bdwgc) mono_generic_class_init (at C:/build/output/Unity-Technologies/mono/mono/mini/jit-icalls.c:1493) 0x00000236ae0e2573 ((<unknown>)) 0x0000023866db21ab (Mono JIT Code) UnityEditor.Search.Providers.Settings/<FetchItems>d__5:MoveNext () 0x0000023866ce6b75 (Mono JIT Code) UnityEditor.Search.SearchEnumerator1<T_REF>:MoveNext ()
0x0000023866ce66fb (Mono JIT Code) UnityEditor.Search.SearchEnumerator1<T_REF>:NextItem (T_REF&) 0x0000023866ce61bb (Mono JIT Code) UnityEditor.Search.BaseAsyncIEnumerableHandler1<T_REF>:FetchSome (System.Collections.Generic.List1<T_REF>,long) 0x0000023866ce18d3 (Mono JIT Code) UnityEditor.Search.SearchService:HandleItemsIteratorSession (object,System.Collections.Generic.List1<UnityEditor.Search.SearchItem>,UnityEditor.Search.SearchProvider,UnityEditor.Search.SearchContext)
0x0000023866cd8933 (Mono JIT Code) UnityEditor.Search.SearchService:GetItems (UnityEditor.Search.SearchContext,UnityEditor.Search.SearchFlags)
0x0000023866cd46cb (Mono JIT Code) UnityEditor.Search.QuickSearch:FetchItems ()
0x0000023866cd36c2 (Mono JIT Code) UnityEditor.Search.QuickSearch:RefreshSearch ()
0x0000023866cbcbd5 (Mono JIT Code) UnityEditor.EditorApplication/<>c__DisplayClass111_0:b__0 ()
0x0000023866cbc8d7 (Mono JIT Code) (wrapper delegate-invoke) :invoke_void ()
0x0000023866cbc59e (Mono JIT Code) UnityEditor.EditorApplication:Internal_InvokeTickEvents ()
0x00000236ee5ccde5 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
0x00007ffd2286e0d4 (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445)
0x00007ffd227aeb74 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3066)
0x00007ffd227aed0c (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3113)
0x00007ff6d3057bc4 (Unity) scripting_method_invoke
0x00007ff6d3036844 (Unity) ScriptingInvocation::Invoke
0x00007ff6d3031495 (Unity) ScriptingInvocation::Invoke
0x00007ff6d317857b (Unity) Scripting::UnityEditor::EditorApplicationProxy::Internal_InvokeTickEvents
0x00007ff6d3c9d811 (Unity) Application::TickTimer
0x00007ff6d411180a (Unity) MainMessageLoop
0x00007ff6d4116910 (Unity) WinMain
0x00007ff6d550133e (Unity) __scrt_common_main_seh
0x00007ffde81c26ad (KERNEL32) BaseThreadInitThunk
0x00007ffde988aa68 (ntdll) RtlUserThreadStart

Well, I guess we just have to wait.
9181898--1279124--upload_2023-7-30_17-35-12.png

Yup, all that took was a little time. (click for a surprising outcome!)
Conclusion

9181898--1279127--upload_2023-7-30_17-39-50.png
Ok, not surprising at all. This is Unity LTS, after all, which must mean Less Than Stable.
(no idea how search can even trigger a protection fault, but here we are)
9181898--1279130--upload_2023-7-30_17-47-56.png
At least the Workers Revolution is finally upon us and the masses turn to the streets!

Usually the workers are pretty lazy, though, and complain about random things.
(in a builtin Unity package, nonetheless, also classic automation test territory - TMPs should naturally be indexable, and correctly so, out of the box, or their violating properties be added to Ignored Properties in Preferences->Search->Indexing by default)

That setting is probably something I would want per-project, by the way, not per Editor/User.

Just a note on that point, pretty sure you can still use names in the asmdef files, if you edit them directly and just ignore the UI. I use them frequently in 2022.2, and from my understanding there should not be any feature changes between the .2 and .3 releases.

Not sure about other IDEs, but rider even autocompletes the names, so searching in the file directly is possible and you dont have to deal with it in their UI ever, which I agree is and always has been a horrible experience.

9182135--1279187--upload_2023-7-31_3-29-18.png

Thank you, that is good to know. :slight_smile:

This is becoming a “I don’t like the new search anymore” thread more than a “asmdef workflow is beyond bad” thread, but after adding 2 indices (one for packages, one for prefabs), my project hangs every other time it recompiles.

Also, even when specifying a property to ignore, it will not be ignored during indexing. (this is after several restarts)

Update - after Search finally and irrevocably broke my project with the last crash (couldn’t open it, even after deleting the Library), I had to roll back version control and consider 2 days of trying to set up search and indices a sunk cost.

I’m done. This is the last time I’ll post on this topic on the forums. I’ll follow up on IN-49756 until that’s closed, and then I’m done with com.unity.searcher. Lesson truly learned, faith in Unity truly damaged.

This picture sums up what I think of com.unity.searcher at this point, and if you look closely, you can see the classic search did exactly what I needed it to do, out of the box.

To also wrap up the loose end of the unabashedly terrible Asmdef Workflow, I found this gem today.

User tertle wrote an Asmdef-Builder. It’s a much better UX. And so much cleaner and simpler.

Others in the Community have moved on, it seems, and used their time more wisely than I did, and didn’t try to make Unity’s own tooling work.

I think my dependency list is longer than this. And I have many asmdefs in my project not just 1. I like breaking down one big assembly into multiple smaller ones.

No, I needed even more. (one or two of the ones in the screenshot were incorrect though)

URP+DOTS projects quickly have a lot of default assemblies that most code somehow depends on. If you need to move that code out of your main game assembly to speed things up, you end up taking all the dependencies with you.

I wish Unity assemblies were auto-referenced or something. Since the search problem is quadratic, humans would have a lot better time knowing that a set of assemblies that very rarely changes is always included as “Engine” or “Auto” code.

In my day job Project, the dependency list is shorter, but more diverse (non-prototype project, lots of code already fully modularized into assemblies)

Hi @Thygrrr (again),

From your explanation it seems the “Classic asset picker” has been replaced by the Advance Picker (powered by the search window).

Classic picker:
9242286--1291761--upload_2023-8-22_15-31-11.png

AdvancedPicker:
9242286--1291764--upload_2023-8-22_15-31-51.png

Just for my mental sanity did you change the Object Selector in the Search Preference page:
9242286--1291767--upload_2023-8-22_15-32-39.png

Or did the Object picker changed when you installed unity? From looking at the code, and wiping all my settings and preference (and windows registry) the Classic picker is still the default (I am testing on 22.3.9f1).

That said it doesn’t excuse the bad experience you had. I just want to better understand what has happened for you to get the Advanced Picker when editing AsmDef.

Thanks for the clarification.

Seb

Hi @Thygrrr ,

I tested the project attached to the bug you logged with 22.3.5f1. Forcing a rebuilding of the Assets index did not crash the Editor but I got:

9242406--1291776--upload_2023-8-22_16-36-14.png

I will investigate further.

The prefab index doesn’t crash though. And finish succesfully. Which index was crashing on your side?

Thanks for the clarification.

I don’t know which one was crashing, but the worker log where the crash was should show you which file it was reading. It’s been a while, I don’t have the project in that state anymore.

Thanks nonetheless. I have enough stuff to investigate. Hopefully indexing fixes should be rolled up in the next 22.3X version. I will keep you posted.

2 Likes