|
1 | 1 | # ScriptableObjectMultiSelectDropdown
|
2 |
| -Multi Select Dropdown for ScriptableObjects |
| 2 | +ScriptableObjectMultiSelectDropdown is an attribute for the Unity Inspector. |
| 3 | +It is used for showing ScriptableObjects which are created in your project, in dropdown menu and select multiple of them in Inspector. |
| 4 | + |
| 5 | +# Usage Example |
| 6 | +1. Clone this repository or download the latest [release package available](https://github.com/ATHellboy/ScriptableObjectMultiSelectDropdown/releases) (There isn't an example folder in `.unitypackage`). |
| 7 | + |
| 8 | +2. Create `ScriptableObject` class which you want to create specified objects by that. |
| 9 | + |
| 10 | +```cs |
| 11 | +using UnityEngine; |
| 12 | + |
| 13 | +[CreateAssetMenu(menuName = "Create Block")] |
| 14 | +public class Block : ScriptableObject |
| 15 | +{ |
| 16 | + // Some fields |
| 17 | +} |
| 18 | +``` |
| 19 | + |
| 20 | +3. Put those created ScriptableObjects in `Resources` folder. |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | +4. Use `ScriptableObjectMultiSelectDropdown` attribute by setting type of specified ScriptableObject derived class and optional grouping (Default grouping is None) like this in `MonoBeahviour` or `ScriptableObject` derived classes. |
| 25 | + |
| 26 | +**MonoBehavior** |
| 27 | + |
| 28 | +```cs |
| 29 | +using ScriptableObjectMultiSelectDropdown; |
| 30 | +using UnityEngine; |
| 31 | + |
| 32 | +public class BlockManager : MonoBehaviour |
| 33 | +{ |
| 34 | + // Without grouping (default is None) |
| 35 | + [ScriptableObjectMultiSelectDropdown(typeof(Block))] |
| 36 | + public ScriptableObjectReference firstTargetBlocks; |
| 37 | + // By grouping |
| 38 | + [ScriptableObjectMultiSelectDropdown(typeof(Block), grouping = ScriptableObjectGrouping.ByFolder)] |
| 39 | + public ScriptableObjectReference secondTargetBlocks; |
| 40 | +} |
| 41 | +``` |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +**ScriptableObject** |
| 48 | +```cs |
| 49 | +using UnityEngine; |
| 50 | +using ScriptableObjectMultiSelectDropdown; |
| 51 | + |
| 52 | +[CreateAssetMenu(menuName = "Create Block Manager Settings")] |
| 53 | +public class BlockManagerSettings : ScriptableObject |
| 54 | +{ |
| 55 | + // Without grouping (default is None) |
| 56 | + [ScriptableObjectMultiSelectDropdown(typeof(Block))] |
| 57 | + public ScriptableObjectReference firstTargetBlocks; |
| 58 | + // By grouping |
| 59 | + [ScriptableObjectMultiSelectDropdown(typeof(Block), grouping = ScriptableObjectGrouping.ByFolderFlat)] |
| 60 | + public ScriptableObjectReference secondTargetBlocks; |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | +# License |
| 69 | +MIT License |
| 70 | + |
| 71 | +Copyright (c) 2019 Alireza Tarahomi |
| 72 | + |
| 73 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 74 | +of this software and associated documentation files (the "Software"), to deal |
| 75 | +in the Software without restriction, including without limitation the rights |
| 76 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 77 | +copies of the Software, and to permit persons to whom the Software is |
| 78 | +furnished to do so, subject to the following conditions: |
| 79 | + |
| 80 | +The above copyright notice and this permission notice shall be included in all |
| 81 | +copies or substantial portions of the Software. |
| 82 | + |
| 83 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 84 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 85 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 86 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 87 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 88 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 89 | +SOFTWARE. |
0 commit comments