unity-history-window: UnityException: Creating asset at path Assets/Gemserk.SelectionHistory.asset failed.
UnityException: Creating asset at path Assets/Gemserk.SelectionHistory.asset failed.
Gemserk.SelectionHistoryReference..cctor () (at ./Library/PackageCache/com.gemserk.selectionhistory@1.1.16/Editor/SelectionHistoryReference.cs:25)
Rethrow as TypeInitializationException: The type initializer for 'Gemserk.SelectionHistoryReference' threw an exception.
Gemserk.SelectionHistoryWindowUtils.SelectionRecorder () (at ./Library/PackageCache/com.gemserk.selectionhistory@1.1.16/Editor/SelectionHistoryWindowUtils.cs:49)
UnityEditor.Selection.Internal_CallSelectionChanged () (at <53ddbed73faf4fe3b980a493ab4e6639>:0)
Not sure what to make of this. It happened on a full project reimport.
Can’t see anything obviously wrong with the code…
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (5 by maintainers)
I think I have the solution for this btw. Unity has a mechanism for this exact pattern.
ScriptableSingleton.You can do this:
And simply remove the
SelectionHistoryReferenceentirely.This also has the advantage of putting the SO in your preferences folder, which (appropriately) takes it out of version control.
I haven’t tested it, but I’m assuming
InitializeOnLoadwill trigger the static instance initialization. If not then maybe this could work:I can open a PR if you’re keen.
Oh, ‘static field’ triggers some brain cells. I have domain reloading off for less pauses while developping. I’m used to recompile once at startup to initialize all static fields in my code. I couldn’t be bothered to fix that issue for now. I’ll get back to if I ever fix it 😄