Request: A [ToggleList] attribute that works much like the AssetList attribute but where you provide its source

Issue #54 new
Ivan Wang
created an issue

The AsssetList attribute is pretty neat, but I'd love to use the functionality of checkboxes for more than just assets.

For example, one use case might be a checkbox that lets you include/exclude components/MonoBehaviours on a GameObject (not just a prefab components).

Alternatively, you could generalize this to take any list as argument (or function returning a list); the attribute would then generate checkboxes for every item in the list, and return a subset (the checked ones) for the property.

Comments (6)

  1. Bjarke Elias Clauson-Kaas Ørrild

    Yeah i would love that as well.

    I've thought a bit about adding a more generic version of AssetLists, where you provide the elements that should be selectable. It could look something like this:

    [ToggleList(source:"GetSelectableSceneObjects")]
    public GameObject[] SceneObjects;
    
    private GameObject[] GetSelectableSceneObjects()
    {
         return ...
    }
    

    We will definitely add that at some point. Soon.

  2. Log in to comment