百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

ScriptableObjectCollection

> 数据库
开源

一套库,可通过将 Unity3D 脚本化对象分组到集合中,并通过代码或用户友好的方式提供便捷访问,从而提高这些对象的可用性

599 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一套库,可通过将 Unity3D 脚本化对象分组到集合中,并通过代码或用户友好的方式提供便捷访问,从而提高这些对象的可用性

Scriptable Object Collection

Most of the time when dealing with Scriptable Objects they all belong to some sort of collection, let's say for example all your consumables on the game? Or maybe all your weapons? Or even all your in-app purchases. Dealing with this can be quite challenging since you have to rely on proper naming of those scriptable objects, this can become a problem super fast as the project continues to grow.

The ScriptableObjectCollection exists to help you deal with scriptable objects without losing your sanity! It's a set of tools that will make your life a lot easier.

Check the FAQ with more examples and use examples.

Features

  • Allow access Scriptable Objects by code, reducing the number of references on the project
  • Group Scriptable Objects that belong together in a simple coherent interface
  • Enable a dropdown selection of all the items inside a collection when the item is serialized through the inspector
  • Automatically generate static access code
  • Allow you to expose the entire object to be tweakable in any inspector
  • Makes the usability of Scriptable Objects in bigger teams a lot better
  • Iterate over all the items of any collection by Collection.Values
  • If you are using the Static Access to the files, if any of the items goes missing, you will have an editor time compilation error, super easy to catch and fix it.

How to use

  1. Create new collections by the wizard Assets/Create/Scriptable Object Collection/New Collection
  2. Now you should treat your new ScriptableObjectCollection as a regular ScriptableObject, add any item you want there
  3. Now add new items to the collection by using the buttons on the Collection Inspector
  4. After you are done, click on Generate Code on the collection to generate the Static access to those objects

[FAQ]

I'm having issues when deleting duplicating items It's really hard to make sure those features work perfectly with the system since it depends on to catch up the GUIDs of the collectables, ALWAYS try to use the Add New / Deleting by the inspector itself

How I can propery serialize this for Save Game or Backend data There's a couple of ways of dealing with this, the easiest one is to use the IndirectReference when you need this data to be serialized, this will only store 2 GUIDs. Another option is writing a proper parser using the ISerializationCallback.

Collection Registry on the Resources Folder Since the CollectionsRegistry is inside the Resources folder, every reference this has to a collection and to all the collectables will be inside the Unity Resources bundle, and if you have a lot of references for expensive stuff, this can increase your startup time significantly, there are 2 things you should keep in mind:

  1. Use the Automatically Loaded items for items that should be available for the lifetime of your game
  2. If you want to use this for more expensive stuff, let's say all the gameplay prefabs, you can uncheck the automatic initialization of this collection, and register the collection on your loading by using CollectionsRegistry.Instance.RegisterCollection(Collection); and removing it when they are not necessary anymore.
  3. You can convert the items of a collection to references by using the "Convert To References" button in the collection inspector. This allows for more flexibility to load and unload items individually. These items are inserted into an Addressables group.

How can I create a new collection You can use the Collection Creating Wizard by right click on the project panel and going into: Assets/Create/Scriptable Object Collection/New Collection this will create 3 items and respective folder: YourCollectionName.cs YourCollectableName.cs and the Collection Scriptable Object

Use a direct reference to the item instead of the dropdown When you add a reference to a Collectable you may choose how you want this to be displayed by adding [CollectionItemEditorOptions].

There are two Draw Types for now:

- DropDown the default option which displays all the available options in a convenient drop-down, like an enum field 
  • AsReference standard Scriptable Object field where you select the asset in a browser

System Requirements

Unity 2018.4.0 or later versions

How to install

Add from OpenUPM | via scoped registry, recommended

This package is available on OpenUPM: https://openupm.com/packages/com.brunomikoski.scriptableobjectcollection

To add the package to your project:

  • open Edit/Project Settings/Package Manager
  • add a new Scoped Registry:
    Name: OpenUPM
    URL:  https://package.openupm.com/
    Scope(s): com.brunomikoski
  • click Save
  • open Package Manager
  • click +
  • select Add from Git URL
  • paste com.brunomikoski.scriptableobjectcollection
  • click Add

Add from GitHub | not recommended, no updates :(

You can also add it directly from GitHub on Unity 2019.4+. Note that you won't be able to receive updates through Package Manager this way, you'll have to update manually.

  • open Package Manager
  • click +
  • select Add from Git URL
  • paste https://github.com/brunomikoski/ScriptableObjectCollection.git
  • click Add

Upgrading Guide:

⚠️ Upgrading from <2.3.0 to 2.4.0 — Important Migration Notes

If you are upgrading ScriptableObjectCollection from a version prior to 2.3.0 to 2.4.0, please read this section carefully to avoid breaking changes and compile errors.


1. Generated Files Now Use the .g.cs Suffix

  • All generated static files now use the .g.cs suffix.
  • Action Required:
    Manually delete any previously generated files that do NOT have the .g.cs suffix from your project.
    Keeping these files may cause compile errors after the upgrade.

2. Namespace and Filename Settings Have Moved

  • Namespace and filename settings are now stored in the .meta file instead of in the generator/collection files.
  • Any custom settings will need to be reconfigured after the upgrade.
  • Old settings are not automatically migrated.

3. Breaking Changes & Versioning

  • This release introduces breaking changes that may cause compile errors if migration steps are not followed.
  • Make sure to read and follow these instructions before or after upgrading.

4. Automatic Cleanup

  • Starting from 2.4.0, the package attempts to automatically delete obsolete generated .cs files (without the .g.cs suffix) during the upgrade process.
  • However, always double-check your generated files and remove any leftovers if necessary.

5. Troubleshooting

If you encounter problems after upgrading:

  • Ensure all old generated files without .g.cs are deleted.
  • Check your collection settings, as these may need to be set again due to the migration to .meta files.
  • Confirm you are using the latest version (2.4.0 or newer).
  • If issues persist, please open an issue.

Migration Steps Checklist

  1. Delete all previously generated files that do not end with .g.cs.
  2. Update the package to version 2.4.0.
  3. Reconfigure your namespace/filename settings if needed.
  4. Verify your project compiles and all generators work as expected.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#assetsassets-managementdatabasescriptableobjects

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库