docs: initial draft of component level docs

This commit is contained in:
bd_ 2023-04-05 20:37:42 +09:00
parent 1dc2f5580f
commit 8e76d0225f
6 changed files with 110 additions and 1 deletions

View File

@ -0,0 +1,28 @@
# Action: Toggle Object
The Action Toggle Object component allows you to configure a menu item to toggle on or off specific game objects.
![Action Toggle Object](action-toggle-object.png)
## When should I use it?
When you want to toggle on or off specific game objects in response to an expressions menu item.
## How do I use it?
Attach an Action Toggle Object component to the same gameobject as a Menu Item component. Then, drag the gameobjects you want to toggle
onto the "objects to show/hide" section, and set the checkboxes to reflect the state those objects should have.
## Default state
If no menu item is selected as the "group default", then the initial state of these gameobjects (when no menu item is selected) will be the state of the gameobjects in the editor.
Any menu items that do not specify the state of those gameobjects will use that initial editor state.
If a menu item is selected as the "group default", then that menu item will be initially selected. When you select a different menu item, it will by default use the opposite of the group default menu item; if the group default menu item does not set the state of a menu item, then instead it'll use the initial editor state of these gameobjects.
In other words, you can build an outfit toggle by setting the "group default" to toggle ON the gameobjects responsible for the initially-active outfit, and then just specifying the gameobjects to turn ON for your other outfits. The initial outfit will automatically turn off when you select some other menu item.
## Limitations
* Only one control group (or ungrouped menu item) can toggle any particular game object.
* Traditional animators in the FX layer will take priority over Action Toggle Object; conversely, Action Toggle Object will take priority over other playable layers.

View File

@ -0,0 +1,16 @@
# Control Group
The control group component allows multiple toggles to be grouped so that only one can be selected at a time.
![Control Group](control-group.png)
## When should I use it?
When you want to create an option that can be in one of several states - for example, an outfit switch.
## How do I use it?
The control group component itself has no configuration; simply add it to a Game Object, and point your [Menu Item](menu-item.md) components at the Control Group.
The control group can be added to any game object, as long as it's inside your avatar. Feel free to put it somewhere convenient for you.
Note that the control group is only used with menu items driving [action components](action-toggle-object.md); for traditional toggles driving animator parameters, simply set those toggles to the same parameter name.

View File

@ -0,0 +1,15 @@
# Menu Group
The menu group asset allows a single menu installer to install multiple menu items without grouping them into a submenu.
It is primarily intended as an internal component for use when converting expressions menus.
![Menu Group](menu-group.png)
## When should I use it?
When you want to install multiple menu items without grouping them into a submenu.
## How do I use it?
The Menu Group component will by default include all Menu Items on direct children of the gameobject it is placed on.
Just as with the Menu Item submenu/children mode, you can set a source object override to select a different source object.

View File

@ -27,6 +27,11 @@ As such, if you want a submenu of your own, you will need to create two menu ass
Add a Menu Installer component to your prefab, at the same level as your [Parameters](parameters.md) component.
Then, open the Prefab Developer Options tag, and add the desired menu to "Menu to install". Done!
### Menu sources
In addition to installing pre-existing menu assets, by attaching a Menu Item or Menu Group component, the menu installer will generate
menu items based on that component's configuration.
### Extending menus of other assets
In some cases, it can be useful to extend a menu that is being installed by another Menu Installer component.

View File

@ -0,0 +1,45 @@
# Menu Item
The Menu Item component allows you to define an expressions menu item from within the Unity hierarchy.
![Menu Item](menu-item.png)
## When should I use it?
This component can provide a more convenient way to edit and define menu items than defining VRC Expressions Menu assets. You can move menu items around by dragging and dropping them through the hierarchy, and it provides an editor interface that is aware of parameter names defined on [MA Parameters](parameters.md) components. In combination with [action components](action-toggle-object.md), you can even define object toggles without having to create any animations or animators.
## How do I use it?
:::tip
A full tutorial on using the menu editor system is available [here](../tutorials/menu/index.md).
:::
The menu item component defines a single menu item in a larger menu. You can configure the icon, menu type, [control group](control-group.md), and parameter for the menu item. The name of the menu item will be taken from the name of the containing game object. This lets you see the name of, and rename menu items directly from the hierarchy.
### Submenus
When menu items are set as a submenu, you can configure where the submenu is sourced from. You can either set submenu source to "Expressions Menu Asset" and configure a traditional VRC Expressions Menu asset to reference, or you can set the 'submenu source' to Children, in which case Menu Items attached to direct children of this menu item are used to populate the submenu.
If the number of items in the submenu exceeds the maximum number of items on a VRC menu, a "next" item will automatically be created to split up the menu.
When submenu source is children, you can also specify a "source object override". If set, the children of that object will be used, instead of the direct children of the menu item.
### Binding submenus
In order to define where a menu item will go in the menu, another component will be needed to _bind_ it to a menu. There are three ways of doing this:
* The menu item can be set as the child of another menu item set in submenu / children mode.
* The menu item can be on the same game object as a [Menu Installer](menu-installer.md) component.
* The menu item can be the child of a [Menu Group](menu-group.md) object (which would typically be on a game object with a Menu Installer component)
Unbound menu items have no effect
### Using with actions
If an [action component](action-toggle-object.md) is on the same object as the menu item, the menu item will be configured to control this action component, instead of controlling an arbitrary parameter. See the action component documentation for details.
When an action component is present on the same object, you can no longer select the parameter name for the menu item; Modular Avatar will automatically assign a parameter at build time. By default, a boolean parameter will be created; if you attach a [control group](control-group.md) to the menu item, an int parameter will be used instead.
When a control group is attached, you can select a single menu item to be the "Group Default". When this is done, this menu item will be set to be initially selected; additionally, for certain types of actions (notably, [Toggle Object](action-toggle-object.md) actions), when _other_ menu items are selected, the action of this default item will be negated (so any objects this action toggles on, will be off by default in other states).

View File

@ -94,7 +94,7 @@ Cubeの隣のチェックは、トグルがになったときは表示す
今後のリリースで改善していく予定です。
## 再利用できるアセットでの応用
## 配布アセットなどでの応用
新しいメニューアイテムシステムを配布アセットなどでも利用できます。サンプルとしては、FingerpenやSimpleToggleアセットにご参照ください。