|
1 | 1 | # Scriptable Object Collection |
2 | 2 |
|
3 | | -[](https://github.com/brunomikoski/ScriptableObjectCollection/blob/develop/LICENSE) |
4 | | -[](https://openupm.com/packages/com.brunomikoski.scriptableobjectcollection/) [](https://www.codacy.com/manual/badawe/ScriptableObjectCollection?utm_source=github.com&utm_medium=referral&utm_content=badawe/ScriptableObjectCollection&utm_campaign=Badge_Grade) |
| 3 | +<p align="center"> |
| 4 | + <a href="https://github.com/brunomikoski/ScriptableObjectCollection/blob/master/LICENSE.md"> |
| 5 | + <img alt="GitHub license" src ="https://img.shields.io/github/license/Thundernerd/Unity3D-PackageManagerModules" /> |
| 6 | + </a> |
| 7 | + |
| 8 | +</p> |
| 9 | +<p align="center"> |
| 10 | + <a href="https://www.codacy.com/gh/brunomikoski/ScriptableObjectCollection/dashboard?utm_source=github.com&utm_medium=referral&utm_content=brunomikoski/ScriptableObjectCollection&utm_campaign=Badge_Grade"><img src="https://app.codacy.com/project/badge/Grade/468941ad106648fc952ee1871840af9f"/></a> |
| 11 | + <a href="https://openupm.com/packages/com.brunomikoski.scriptableobjectcollection/"> |
| 12 | + <img src="https://img.shields.io/npm/v/com.brunomikoski.scriptableobjectcollection?label=openupm&registry_uri=https://package.openupm.com" /> |
| 13 | + </a> |
| 14 | + |
| 15 | + <a href="https://github.com/brunomikoski/ScriptableObjectCollection/issues"> |
| 16 | + <img alt="GitHub issues" src ="https://img.shields.io/github/issues/brunomikoski/ScriptableObjectCollection" /> |
| 17 | + </a> |
| 18 | + |
| 19 | + <a href="https://github.com/brunomikoski/ScriptableObjectCollection/pulls"> |
| 20 | + <img alt="GitHub pull requests" src ="https://img.shields.io/github/issues-pr/brunomikoski/ScriptableObjectCollection" /> |
| 21 | + </a> |
| 22 | + |
| 23 | + <img alt="GitHub last commit" src ="https://img.shields.io/github/last-commit/brunomikoski/ScriptableObjectCollection" /> |
| 24 | +</p> |
| 25 | + |
| 26 | +<p align="center"> |
| 27 | + <a href="https://github.com/brunomikoski"> |
| 28 | + <img alt="GitHub followers" src="https://img.shields.io/github/followers/brunomikoski?style=social"> |
| 29 | + </a> |
| 30 | + <a href="https://twitter.com/brunomikoski"> |
| 31 | + <img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/brunomikoski?style=social"> |
| 32 | + </a> |
| 33 | +</p> |
5 | 34 |
|
6 | | -[](https://github.com/brunomikoski) [](https://twitter.com/brunomikoski) |
7 | 35 |
|
8 | 36 |
|
9 | 37 | Most of the time when dealing with Scriptable Object they all belong to some sort of collections, let's say for example all your consumables on the game? Or maybe all your weapons? Or even all your in-app purchases. And 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. |
@@ -36,7 +64,37 @@ Check the [FAQ](https://github.com/brunomikoski/ScriptableObjectCollection/wiki/ |
36 | 64 | 4. After you are done, click on Generate Code on the collection to generate the Static access to those objects |
37 | 65 |
|
38 | 66 |
|
39 | | -## [FAQ](https://github.com/brunomikoski/ScriptableObjectCollection/wiki/FAQ) |
| 67 | +## [FAQ] |
| 68 | +<details> |
| 69 | + <summary>I'm having issues when deleting duplicating items</summary> |
| 70 | + 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 |
| 71 | +</details> |
| 72 | + |
| 73 | +<details> |
| 74 | + <summary>How I can propery serialized this for Save Game or Backend data</summary> |
| 75 | +There's a couple of ways of dealing with this, the easiest one its to use the `IndirectReference` when you need this data to be serialized, this will only store 2 GUIDs. |
| 76 | + Another option its properly writing a proper parser using the ISerializationCallback. |
| 77 | +</details> |
| 78 | + |
| 79 | +<details> |
| 80 | + <summary>Collection Registry on the Resources Folder</summary> |
| 81 | +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 have a lot of references for expensive stuff, this can decrease your startup time significantly, there are 2 things you should keep in mind: |
| 82 | +1. Use the Automatically Loaded items for items that should be available for the lifetime of your game |
| 83 | +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. |
| 84 | +</details> |
| 85 | + |
| 86 | + <details> |
| 87 | + <summary>How can I create a new collection</summary> |
| 88 | +You can use the Collection Creating Wizzard 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 |
| 89 | + |
| 90 | +</details> |
| 91 | + |
| 92 | + |
| 93 | + <details> |
| 94 | + <summary>Use a direct reference to the item instead of the dropdown</summary> |
| 95 | +When you add a reference to a Collectable you may choose how you want this to be displayed, there are two options for now: `DropDown` / `AsReference`, reference its exactly what you would expect, the user should assign this reference by selecting inside the project, and the default one `DropDown` display all the available options in a drop-down: |
| 96 | + |
| 97 | +</details> |
40 | 98 |
|
41 | 99 |
|
42 | 100 | ## System Requirements |
|
0 commit comments