
Tools utilities
Collection UI Elements
A quick and easy way to collect your user interface elements into one collection and then get objects by their name or by index. Add your own element types.
A quick and easy way to collect your user interface elements into one collection and then get objects by their name or by index. Add your own element types.
To use a collection, you need to add the “Collection UI Elements” script to the object.
It is recommended to add UI elements to the parent object. In this case, the “Menu” object.
This component is the main link in working with the asset.
A slot in a collection has three fields.
To generate a class with an enumeration of slot names, select a collection for which the list will be created and a name by which it will be possible to refer to the slot name (The enumeration itself stores the name of the slot, but not the object). Then click generate.
Working with an enum is to remove it (may change in the future).
Type Support – types by which objects will be searched and maybe something else later.
For example Let’s add CollectionUIElements to types. To do this, click on the add custom type button. He appeared at the very top of the list. Let’s give it a name and type: We specify the name in Latin letters, since I used the namespace, I also indicated it “NMe8.CollectionUIElements” and after the “CollectionUIElements” class itself. I will not ignore children, since this class hangs on the first object when searching. Now you can save (Unity will generate the file and check all the files, it takes 5 seconds). If you remove the type, the slots in the collection that have that type will take on the standard GameObject type.
First you need to add using NMe8.CollectionUIElements. then we declare a CollectionUIElements variable to refer to a particular collection of elements.
And now, through our new variable, we can access methods.