Releases: brunomikoski/ScriptableObjectCollection
Releases · brunomikoski/ScriptableObjectCollection
Bitmask-Accelerated Queries & API Cleanup
Added
- New
PreviewModeenum (Default/Inline/PropertyEditorWindow) onSOCItemEditorOptionsAttribute, plus a matching project-wide default inSOCSettings(Project Settings > Scriptable Object Collection > Item Inspector). When set toPropertyEditorWindow, the per-field Edit button opens Unity's floating Property Editor viaEditorUtility.OpenPropertyEditorinstead of the inline preview panel — fixes rendering issues with third-party inspectors (e.g. Odin) that don't draw correctly in the inline IMGUI drawer.Defaulton the attribute defers to the project setting; project setting defaults toInlineso existing behavior is unchanged. - New
CollectionItemMask64static helper plusIEnumerable<T>.ToItemMask64<T>()andList<T>.FromItemMask64<T>()extension methods. Provides a 64-bit bitmask representation of a set of collection items keyed onScriptableObjectCollectionItem.Index, withBit/Has/Add/Remove/Overlaps/IsSubsetOfhelpers and aFrom<T>(items, out bool fits)builder that flags when any item'sIndex >= 64. Bit positions are per-collection — callers are responsible for only comparing masks built from items of the same collection. CollectionItemPicker<T>now exposes a cached bitmask (CachedMask) and aCanUseBitmaskgate (combinesMaskFitsIn64with every item collection'sSupportsBitmaskIndexingflag), plusCountMatchesIn(ulong)andCountMatchesIn(IEnumerable<T>)overloads backed by a SWARPopCount. The mask is rebuilt onOnAfterDeserialize, on every mutating operation (Add/Clear/Remove/Insert/RemoveAt/indexer set), and lazily in Edit Mode; reused without rebuild in Play Mode.ScriptableObjectCollectionvirtualSupportsBitmaskIndexing(defaulttrue). Override tofalseon collections whose item ordering can change at runtime (e.g. CDN-delivered content) so the bitmask fast path is skipped — each item'sIndexis cached on first access and would otherwise go stale after a reorder.CollectionItemPicker<T>.ToString()override returning[item1, item2, ...](empty collection renders as[]; null entries render as<null>). UsesStringBuilderto avoid per-call allocations on long pickers.CollectionItemQuery<T>.IsEmpty()returnstruewhen everyQuerySet's picker contains zero items — useful for skipping theMatchesevaluation on default-constructed queries.CollectionItemPickerPropertyDrawernow writesitemLastKnownNameandcollectionLastKnownNamewhen an entry is added to a picker, so newly added items have populated cache names immediately instead of empty strings.
Changed
- Reverted
CollectionItemQuery.MatchTypeenum values:SomeNot→NotAny,None→NotAll. The new names mirrorAny/Alland describe the actual semantics (target has none of the picker items / target is missing at least one of them). Integer values are preserved (2 and 3), so existing serializedQuerySetdata deserializes unchanged. - Added XML documentation on
MatchTypevalues and theMatchesmethod to surface the semantics in IntelliSense. CollectionItemQuery<T>.Matchesnow selects between a bitmask fast path (MatchesViaBitmask) and the existing GUID-based path (MatchesViaGuids) at the start of each call. The bitmask path is used only when everyQuerySet's picker reportsCanUseBitmask == true; otherwise the call falls back to the original GUID comparison. Match results are unchanged — only the evaluation strategy.CollectionItemPicker<T>events renamed:OnItemTypeAddedEvent→OnItemAddedEvent,OnItemTypeRemovedEvent→OnItemRemovedEvent. The old names are preserved as[Obsolete]shims with explicitadd/removeaccessors that forward subscriptions to the new events, so existing+=/-=call sites keep compiling with a deprecation warning pointing to the new name. The shims will be removed in a future major version.OnChangedEventis unchanged.CollectionItemIndirectReference.itemLastKnownNameandcollectionLastKnownNameare now wrapped in#if UNITY_EDITORand no longer compiled into player builds. Runtime resolution relies exclusively on GUIDs.CollectionItemQuery<T>.Matches(IEnumerable<T> targetItems, out int)now tolerates anulltargetItems— treated as empty, soAny/Allsets fail andNotAny/NotAllsets pass.
Fixed
CollectionItemQueryPropertyDrawer.IsCombinationImpossibleno longer reports false positives forAny+NotAnyandAll+NotAllrule pairs. Impossibility for these now requires the stricter subset relationship between pickers (not just any intersection), matching the real-world satisfiability.All+NotAnycontinues to be flagged on any intersection, which is correct.CollectionItemPickerandCollectionItemIndirectReference<T>now implementISerializationCallbackReceiverto invalidate their runtime caches on deserialization, so inspector edits to a picker during Play Mode take effect immediately instead of returning the stale cachedItems/Ref.CollectionItemIndirectReferencePropertyDrawernow re-syncs staleitemLastKnownName/collectionLastKnownNamefrom the live asset and collection names on every draw (viaApplyModifiedPropertiesWithoutUndo), preventing the cached names from drifting when an asset is renamed outside the inspector.
Removed
- Removed the runtime fallback in
CollectionItemIndirectReference.TryGetCollectionItemthat, when the stored GUIDs failed to resolve, attempted to look the collection and item back up bycollectionLastKnownName/itemLastKnownName. With the names now editor-only, GUID is the single runtime lookup path; rename recovery is handled at edit time by the drawer instead. - Removed long-deprecated
[Obsolete]API surface that has been carrying compile warnings across prior releases:SOCSettings.SetDefaultNamespace(string)— useSetNamespacePrefix(string)instead.- The four
ScriptableObjectCollectionUtility.CreateScriptableObjectOfType(...)overloads that took aparentFolder/parentFolderPathplus acreateFolderForThisCollectionbool. Use the overloads that take a complete path; build the path withPath.Combineat the call site if you previously relied on the auto-folder behavior. DrawAsSOCItemAttribute— no longer needed since Unity 2022.2 supportsPropertyDraweron interfaces directly.CollectionItemEditorOptionsclass — useSOCItemEditorOptionsAttributeinstead.CollectionsRegistry.GetCollectionByGUID(string)— use theLongGuidoverload (regenerate your collection's static access class to pick up the new GUID type).ScriptableObjectCollection.GetItemByGUID(string)— use theLongGuidoverload (same: regenerate the static access class).
New Processor and more QoL changes and improvements
Added
- New
SOCItemGuidProcessorasset postprocessor that enforces valid and unique GUIDs on collection items at import time, replacing the inline validation inCollectionsAssetsPostProcessor - Custom
CollectionItemQueryPropertyDrawerwith foldout UI, rule editing, match type constraint filtering, impossible-rule detection, and human-readable query summaries - GUID-based lookup caching for collections (
CollectionsRegistry) and items (ScriptableObjectCollection) for faster retrieval CollectionItemIndirectReferencenow caches resolved references with ahasCachedRefflag to avoid repeated resolution attempts- Enhanced error logging in
CollectionItemPickerPropertyDrawerwith last known names and property paths DrawAdditionalIMGUI()extension point inCollectionCustomEditorfor subclass customization- GitHub Copilot review instructions (
.github/instructions.md)
Changed
- Renamed
CollectionItemQuery.MatchTypeenum values:NotAny→SomeNot,NotAll→None - Reduced GC allocations in
CollectionItemQuery.Matches()by reusing aHashSetinstead of creating a new one per call (by @emtony) CollectionItemDropdownnow redirects to the collection when the item type has derived types, instead of immediately creating an item- Code generation now outputs UTF-8 without BOM and handles both
\r\nand\nline endings - Refactored
newmodifier detection logic in code generation with improved base type filtering CollectionItemPickernow uses reverse iteration for safe removal during enumeration- Refactored
CollectionsRegistry.ValidateCollections()to validate items within collections using HashSets for duplicate detection - Improved bidirectional type assignability check in
CollectionsRegistry.GetCollectionsByItemType() - Robust UXML asset loading in
CollectionCustomEditorwith error handling for missing visual tree assets
Fixed
ScriptableObjectCollection<T>.ClearCachedValues()now callsbase.ClearCachedValues()to properly clear name/GUID lookup dictionaries- GUID cache lookups (
TryGetItemByGUID,GetCollectionByGUID) now validate the cached entry's GUID still matches before returning, evicting stale entries SOCItemGuidProcessordeleted asset handling: entries are now removed by path matching instead of attempting to load already-deleted assets- Removed UTF-8 BOM from
SOCItemGuidProcessor.csand its.metafile - Fixed typo
IsKnowCollection→IsKnownCollectionacross multiple files - Fixed typo
collectionLastKnowName→collectionLastKnownNamewithFormerlySerializedAsfor backward compatibility - Fixed method name
SetUsingBaseClassForItems→SetUseBaseClassForItems - Improved null/destroyed Unity object equality checks in
ScriptableObjectCollectionItem - Removed
OnValidate()auto-GUID generation fromScriptableObjectCollectionItem(now handled by the processor)
v2.5.0 - Bug Fixes and QoT Improvements
What's Changed
Changed
- Fixed issue with the
TreeViewand the unity version compatibility by @RoyTheunissen #182 - LongGuids are now displayed via their base64 string by @RoyTheunissen #184
IndirectReferencesare not generated per item type, so it can filter what type of items can be displayed on the picker- Fixed issue where renaming one asset on the CollectionEditor could cause some issues
- Fixed
IndirectReferencenot properly saving items from the dropdown when used inside arrays - Fixed overall issues with the
CollectionItemQuery.cs - Fixed Item picker not respecting the inheritance of items when displayin the picker
- GUID are now not serialized when invalid, so it doesn't get reserialized in invalid states (#183)
Added
- Added the option to omit labels in arrays and lists by @RoyTheunissen #181
- Added indirect conversion between
IndirectReferenceand Item type so they can used as regular SOCItem - Menu for generating Static Access for all the collection under the
Tools/ScriptableObjectCollectionmenu - Menu for generating Indirect Reference file for all the collection under the
Tools/ScriptableObjectCollectionmenu - Added extra validation for valid filenames when creating new collections/items
Pull Requests
- Bumped the minimum version number for the generic TreeViewState to 6000.1 by @RoyTheunissen in #182
- Feature/omit labels in arrays and lists by @RoyTheunissen in #181
- LongGuids are now displayed via their base64 string. by @RoyTheunissen in #184
- Feature/fix picker not respecting inheritance by @brunomikoski in #185
- Feature/extra checks and features by @brunomikoski in #186
Full Changelog: v2.4.2...v2.5.0
Bug fixes and improvements
What's Changed
- Fixed the assembly definition search not checking for consistent fold… by @RoyTheunissen in #177
- Set up menu paths so they update if you rename the collection by @RoyTheunissen in #178
- Feature/small fixes by @brunomikoski in #179
Full Changelog: v2.4.1...v2.4.2
Bug Fixes and Improvements
What's Changed
- Fixed issue when creating multiple items without renaming it would cause a null reference.
- Removed Synchronize Assets button from the Collection Editor, this is already happening multiple times
- Renamed Generator button to Run Generator instead of Generate Items since was misleading
- Fixed use of
AssetPathExistson older Unity versions - Removed Syncronize Button (was not needed anymore)
- Fixed generator not refreshing CollectionEditor after running the generator
- Fixed unique name generation for new items
Added
- Added new label options to make the picker smaller
- Feature/more fixes by @brunomikoski in #171
- Fix AssetDatabase.AssetPathExists compatibility for Unity versions before 2023.1 by @octo127 in #172
- Added the option to hide the label to make it more compact by @RoyTheunissen in #173
- Bug Fixes by @brunomikoski in #174
- fix: null check by @brunomikoski in #175
New Contributors
Full Changelog: v2.4.0...v2.4.1
2.4.0 - QoL and Fixes
What's Changed
Changed
- Fixed generated static access code overwriting the collection definition
- Pre 2.3.0 collections will now be assumed to want a namespace setting that is the same namespace as its item type
- When generating static/indirect access code using the new
.g.cssuffix, existing static/indirect access code that uses the old.cssuffix is now automatically removed to prevent compile errors - Added Generic SetValue for Collection Generator
- Feature/smoother migration to 2 3 0 by @RoyTheunissen in #168
- Added generic value support for generators by @brunomikoski in #169
Full Changelog: v2.3.9...v2.4.0
Improving duplicating collection and other quality of life improvements
Changed
- Added some general fixes to validate Collection and Items have unique
LongGuid - Fixed issues when after some operation with the context menu on the CollectionEditor items would not refresh properly
- Fixed issue when moving items between collection would not generate unique names
- Removed the post processing of assets that tried to assign items to collections automatically, since this was causing issue when duplicating collections, everyting now is done on the collection
- Overall code improvement and organization
Added
- Added new Context Menu for moving items between collections
- Added the new PropertyDrawer that shows what Collection every item belongs to
- Added a few more Confirmation dialog when detecting items that looks wrong
What's Changed
- Bug fixes and improvements by @brunomikoski in #167
Full Changelog: v2.3.8...v2.3.9
Small fixes and QoL Improvements
Changed
- Fixed naming issue on the new Move Items context menu introduced on [2.3.7]
- Renamed
Delete ItemtoRemove Itemon the context menu - Updated the Confirmation for the Removal of items, now ask if you just want to remove the reference, remove the reference and delete the asset or cancel the operation
- Exposed OnEnable and OnDisable from the CollectionCustomEditor to be overriden by other editors
What's Changed
- Fix on context menu and other small fixes by @brunomikoski in #165
Full Changelog: v2.3.7...v2.3.8
Unity 6 support and other improvements
What's Changed
Added
- Added new context menu to move items between collections
- Added new Rename context menu
- Added new CollectionItemQuery to be used with ItemPIcker
Changed
- Improved Unity 6 support
- Fixed null ref when collections settings where not set
- Fixed some renaming issues
- Changed event where non automatically loaded items are removed on editor simulation
- Fixed null ref on empty collection
- Ensured that the namespace for generated code is the same as the script by default by @RoyTheunissen in #161
- Feature/unity 6 support by @brunomikoski in #162
Full Changelog: v2.3.6...v2.3.7
Improved Context Menu Usability
What's Changed
- Updated ListView to allow for multiple selection
- Updated Context Menu functionality to support multiple selection (Copy/Paste/Duplicate/Delete)
- Feature/qol asset manipulation by @brunomikoski in #156
Full Changelog: v2.3.5...v2.3.6