| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
C# Attributes that allow you to quickly assign Unity assets from a Dropdown on the Inspector. Support any UnityEngine.Object types. Help save time and reduce human errors by letting you pick an object from your desired location.
Note
This Library is not an Official Library from Unity.
[FromFolder] - Display a Dropdown of Unity Assets from a specific Folder.
[FromGroup] - Display a Dropdown of Unity Assets from the ScriptableGroup with a matching name.
[FromConfig] - Display a Dropdown of Unity Assets from a first found ScriptableContainer with a specified type.
[FromAddressable] - Display a Dropdown of Addressable Assets from a specific Addressable Group.
Supported List & Array (Both direct usage & nested elements)
QoL Features:
For ScriptableObjects:
There are 2 options to install the package:
using PhEngine.QuickDropdown;
using UnityEngine;
public class QuickDropdownExample : MonoBehaviour
{
public float health;
//Let user pick 'ElementConfig' asset from the ScriptableGroup named 'TestGroup' in the asset folder.
//By default, This also display Inspect button, Create button (Only for ScriptableObjects), and a mini button to jump to the enclosing group.
[FromGroup("TestGroup"), SerializeField]
ElementConfig element;
//Let user pick 'ElementConfig' from a first found ScriptableObject with the type of 'SampleConfig'
[FromConfig(typeof(SampleConfig)), SerializeField]
ElementConfig sampleConfigItem;
public float attack;
public float stamina;
//Let user pick Sprite from the folder 'Assets/Sprites' and all the subfolders below.
//The folder information is hidden from 'isHideInfo' flag
//These path variations also work: 'Assets/Sprites', 'Assets/Sprites/', 'Sprites/'
[FromFolder("Sprites", isHideInfo: true), SerializeField]
Sprite sprite;
//By default, Inspect button will open the assigned asset as a floating window.
//You can change the button behaviour using different InpsectModes
[FromFolder("Prefabs", inspectMode: InspectMode.Select), SerializeField]
GameObject prefab;
}//Quick Dropdown now directly supports List & Array
[FromGroup("TestGroup"), SerializeField]
List<ElementConfig> directList = new List<ElementConfig>();
[FromGroup("TestGroup"), SerializeField]
ElementConfig[] directArray = new ElementConfig[] {};
//Nested List & Array also works
[SerializeField] List<ElementConfigData> nestedDropdownList = new List<ElementConfigData>();
[SerializeField] ElementConfigData[] nestedDropdownArray = new ElementConfigData[] {};If you have the Addressables package installed in the project, you can use [FromAddressable] attribute on Unity Object fields and string fields to display a dropdown of Addressable assets from a desired group.
using PhEngine.QuickDropdown.Addressables;
using UnityEngine;
public class AddressableDropdownExample : MonoBehaviour
{
[FromAddressable("PackedAddressableGroup"), SerializeField]
ElementConfig addressableConfig;
[FromAddressable("PackedAddressableGroup"), SerializeField]
string addressableAddress;
}Note
Unfortunately [FromAddressable] does not work with AssetReference at the moment. Since it is drawn by its own property drawer.
Please feel free to Contribute and send me Pull requests. You can also Buy me a coffee!☕
| Back | FazBrowse Home | New Git URL |