### Install Plugin via CLI Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/claude-plugin.html Installs the App UI plugin from the registered marketplace. ```bash /plugin install app-ui@unity-app-ui ``` -------------------------------- ### Setup component Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Editor.StoryBookComponent.html Initializes the component with the provided VisualElement. ```csharp public virtual void Setup(VisualElement element) ``` -------------------------------- ### Custom Color Picker Example Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.ColorField.html An example demonstrating how to implement and use a custom color picker with the ColorField. ```APIDOC ## Custom Color Picker Example ### Description This example shows how to create a custom implementation of `ICustomColorFieldPicker` and assign it to a `ColorField`. ### Code Example ```csharp // Example implementation of a custom color picker public class CustomColorPicker : ICustomColorFieldPicker { private VisualElement m_PickerWindow; private Action m_OnValueChanging; private ColorField m_Owner; private Color m_InitialColor; public void Show(ColorField owner, Action onValueChanging, Color initialColor, bool showAlpha, bool hdr) { m_Owner = owner; m_OnValueChanging = onValueChanging; m_InitialColor = initialColor; // Create custom picker UI m_PickerWindow = new VisualElement { name = "custom-picker" }; // Setup picker with callbacks var picker = new MyCustomPickerUI(initialColor, showAlpha, hdr); picker.onColorChanged += (color) => { // Send ChangingEvent while picker is still open m_OnValueChanging?.Invoke(color); }; picker.onColorAccepted += (color) => { // Send final ChangeEvent like the default implementation using var evt = ChangeEvent.GetPooled(m_InitialColor, color); evt.target = m_Owner; m_Owner.SetValueWithoutNotify(color); m_Owner.SendEvent(evt); ClosePickerWindow(); }; picker.onCanceled += () => { // Revert to initial color m_OnValueChanging?.Invoke(m_InitialColor); ClosePickerWindow(); }; m_PickerWindow.Add(picker); owner.rootVisualElement.Add(m_PickerWindow); } private void ClosePickerWindow() { m_PickerWindow?.RemoveFromHierarchy(); m_OnValueChanging = null; m_Owner?.Focus(); } } // Usage: var colorField = new ColorField(); colorField.customPicker = new CustomColorPicker(); ``` ``` -------------------------------- ### Create and Apply Middleware Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Redux.Middleware-1.html Example of implementing a logging middleware and applying it to a store using Store.ApplyMiddlewares and Store.ComposeEnhancers. ```csharp // Middleware that logs all actions var loggerMiddleware = (store) => next => action => { Debug.Log($"Dispatching action: {action}"); // Call the next middleware in the chain next(action); }; // Apply the middleware to the store var middlewares = Store.ApplyMiddlewares(loggerMiddleware); var enhancer = Store.ComposeEnhancers(middlewares, DefaultEnhancer.GetDefaultEnhancer()); var store = Store.CreateStore(reducer, initialState, enhancer); ``` -------------------------------- ### Generated UxmlCloneTree Method Example Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/uxml-source-generators.html Example of auto-generated code for the UxmlCloneTree method, which loads, clones the UXML, and queries elements. ```csharp // Auto-generated code using global::UnityEngine.UIElements; namespace MyApp.UI { public partial class MyElement { [global::System.Runtime.CompilerServices.CompilerGenerated] private void UxmlCloneTree() { var template = global::UnityEngine.Resources.Load("UI/MyElement"); if (template) { template.CloneTree(this); SubmitButton = this.Q("submitButton"); m_TitleLabel = this.Q("titleLabel"); m_InputField = this.Q("inputField"); } } } } ``` -------------------------------- ### Verify Plugin Installation Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/claude-plugin.html Commands to verify the existence of skill manifests and plugin configuration files. ```bash ls ./Packages/com.unity.dt.app-ui/Plugins~/skills/ ls ./Packages/com.unity.dt.app-ui/Plugins~/skills.json ``` ```bash ls ./Packages/com.unity.dt.app-ui/Plugins~/.claude-plugin ``` ```bash ls ./Packages/com.unity.dt.app-ui/Plugins~/skills/ ``` -------------------------------- ### PrepareAnimateViewIn method Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.AnchorPopup-1.html Performs final layout preparation one frame before animation starts. ```csharp protected override void PrepareAnimateViewIn() ``` -------------------------------- ### BuildWith Method Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.MVVM.AppBuilder.html Initializes the application using the provided host instance. ```csharp public IApp BuildWith(THost host) where THost : class, IHost ``` -------------------------------- ### NavGraph Start Destination Property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Navigation.NavGraph.html Sets the starting destination for this NavGraph. This property must be set for the NavGraph to be considered valid. ```csharp public NavDestination startDestination { get; set; } ``` -------------------------------- ### SetupAppBar Method Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Navigation.INavVisualController.html Sets up the app bar for a given navigation destination. ```APIDOC ## POST /api/SetupAppBar ### Description Setup the app bar. ### Method POST ### Endpoint /api/SetupAppBar ### Parameters #### Request Body - **appBar** (AppBar) - Required - The app bar to setup. - **destination** (NavDestination) - Required - The destination to setup the app bar for. - **navController** (NavController) - Required - The navigation controller. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure of the operation. ### Request Example ```json { "appBar": {}, "destination": {}, "navController": {} } ``` ### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### Get Localized String with LangContext Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/localization.html Use this to get a localized string based on the current LangContext. Register a callback to be notified when the context changes. ```csharp using Unity.AppUI.UI; public class MyComponent : BaseVisualElement { public MyComponent() { this.RegisterContextChangedCallback(OnLangContextChanged); } // This method will be called when the LangContext changes async void OnLangContextChanged(ContextChangedEvent evt) { var ctx = evt.context; if (ctx != null) { var translatedString = await ctx.GetLocalizedStringAsync("@myTable:myEntry"); } } // This method will check for the currently provided locale // without using any listener public void TranslateNow() { var ctx = this.GetContext(); if (ctx != null) { var translatedString = ctx.GetLocalizedStringAsync("@myTable:myEntry"); } } } ``` -------------------------------- ### SetupDrawer Method Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Navigation.INavVisualController.html Sets up the drawer for a given navigation destination. ```APIDOC ## POST /api/SetupDrawer ### Description Setup the drawer. ### Method POST ### Endpoint /api/SetupDrawer ### Parameters #### Request Body - **drawer** (Drawer) - Required - The drawer to setup. - **destination** (NavDestination) - Required - The destination to setup the drawer for. - **navController** (NavController) - Required - The navigation controller. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure of the operation. ### Request Example ```json { "drawer": {}, "destination": {}, "navController": {} } ``` ### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### NavGraph FindStartDestination Method Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Navigation.NavGraph.html Finds and returns the start destination for the current NavGraph. This method is used to retrieve the designated starting point of the navigation graph. ```csharp public NavDestination FindStartDestination() ``` -------------------------------- ### Implement localization in App UI Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/localization.html Examples of applying localized strings to button elements in UXML and C#. ```UXML ``` ```C# myButton.title = "@table_name:entry_key"; ``` -------------------------------- ### Get Orientation USS Class Name Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.SplitView.html Gets the USS class name for a given direction. This is useful for applying custom styling via USS. ```csharp public static string GetOrientationUssClassName(Direction enumValue) ``` -------------------------------- ### SetupBottomNavBar Method Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Navigation.INavVisualController.html Sets up the bottom navigation bar for a given navigation destination. ```APIDOC ## POST /api/SetupBottomNavBar ### Description Setup the bottom navigation bar. ### Method POST ### Endpoint /api/SetupBottomNavBar ### Parameters #### Request Body - **bottomNavBar** (BottomNavBar) - Required - The bottom navigation bar to setup. - **destination** (NavDestination) - Required - The destination to setup the bottom navigation bar for. - **navController** (NavController) - Required - The navigation controller. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure of the operation. ### Request Example ```json { "bottomNavBar": {}, "destination": {}, "navController": {} } ``` ### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### ActionBar message Property Declaration and Example Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.ActionBar.html Declares the message property for the item selection message. It recommends using a SmartString for dynamic text based on selection count. An example of SmartString usage is provided. ```csharp [Tooltip("Text used for item selection message.\n\nWe recommend to use a SmartString text in order to adjust the text based on the number of selected items.\nExample: {itemCount:plural:Nothing selected|One selected item|{} selected items}")] public string message { get; set; } ``` ```plaintext {itemCount:plural:Nothing selected|One selected item|{} selected items} ``` -------------------------------- ### SetupNavigationRail Method Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Navigation.INavVisualController.html Sets up the navigation rail for a given navigation destination. ```APIDOC ## POST /api/SetupNavigationRail ### Description Setup the navigation rail. ### Method POST ### Endpoint /api/SetupNavigationRail ### Parameters #### Request Body - **navigationRail** (NavigationRail) - Required - The navigation rail to setup. - **destination** (NavDestination) - Required - The destination to setup the navigation rail for. - **navController** (NavController) - Required - The navigation controller. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure of the operation. ### Request Example ```json { "navigationRail": {}, "destination": {}, "navController": {} } ``` ### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### Create a basic Store Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/state-management.html Initializes a generic store with a state object and a reducer function. ```csharp using Unity.AppUI.Redux; record MyState {} var store = Store.CreateStore((state, action) => state, new MyState()); ``` -------------------------------- ### MaskField Get Mask Value Property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.MaskField.html Gets or sets a delegate function used to retrieve the mask value for a specific index within the source items collection. This is crucial for defining how each item contributes to the overall mask. ```csharp public MaskField.GetMaskValueDelegate getMaskValue { get; set; } ``` -------------------------------- ### Store Constructor Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Redux.Store-1.html Details on how to create a new Store instance. ```APIDOC ## Store(Reducer, TStoreState) Creates a Redux store that holds the complete state tree of your app. ### Declaration ```csharp [Preserve] public Store(Reducer reducer, TStoreState initialState) ``` ### Parameters Type | Name | Description ---|---|--- Reducer | reducer | The root reducer that returns the next state tree. TStoreState | initialState | The initial state of the store. ### Remarks You should not use directly this constructor to create a store. Instead, use `Store.CreateStore` to create a store with optional enhancers. This constructor should be called only by enhancers to return an enhanced store. ``` -------------------------------- ### MaskField Get Display Name Property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.MaskField.html Gets or sets a delegate function used to retrieve the display name for a specific index within the source items collection. This allows for custom display text based on the item's index. ```csharp public MaskField.GetDisplayNameDelegate getDisplayName { get; set; } ``` -------------------------------- ### Load Plugin Directly for Development Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/claude-plugin.html Starts a Claude Code session with the plugin loaded directly from the specified directory. ```bash claude --plugin-dir ./Packages/com.unity.dt.app-ui/Plugins~ ``` -------------------------------- ### Create navigation screen instance Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Navigation.DefaultDestinationTemplate.html Method to instantiate a navigation screen managed by a NavHost. ```csharp public override INavigationScreen CreateScreen(NavHost host) ``` -------------------------------- ### AnimateViewIn method Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.AnchorPopup-1.html Starts the entry animation for the popup. ```csharp protected override void AnimateViewIn() ``` -------------------------------- ### Setup screen UI components Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Navigation.NavigationScreen.html Methods for configuring specific UI elements like AppBars, BottomNavBars, Drawers, and NavigationRails for a screen. ```csharp protected virtual void SetupAppBar(AppBar appBar, NavController controller) ``` ```csharp protected virtual void SetupBottomNavBar(BottomNavBar bottomNavBar, NavController controller) ``` ```csharp protected virtual void SetupDrawer(Drawer drawer, NavController controller) ``` ```csharp protected virtual void SetupNavigationRail(NavigationRail navigationRail, NavController controller) ``` -------------------------------- ### LangContext.GetLocalizedStringAsyncDelegate Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Core.LangContext.GetLocalizedStringAsyncDelegate.html The delegate to get a localized string asynchronously. ```APIDOC ## Delegate LangContext.GetLocalizedStringAsyncDelegate ### Description The delegate to get a localized string asynchronously. ### Namespace Unity.AppUI.Core ### Assembly Unity.AppUI.dll ### Syntax ```csharp public delegate Task LangContext.GetLocalizedStringAsyncDelegate(string referenceText, string lang, params object[] arguments) ``` ### Parameters #### Path Parameters - **referenceText** (string) - Required - The reference text. - **lang** (string) - Required - The language. - **arguments** (object[]) - Required - The arguments to format the string. ### Returns - **Task** - The localized string. ``` -------------------------------- ### PushSubMenu (Details) Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.MenuBuilder.html Creates an action menu item with specified details, adds a sub-menu to the current menu, and makes it the current menu. ```APIDOC ## POST /api/menu/push-submenu/details ### Description Creates an action menu item with specified details, adds a sub-menu to the current menu, and makes it the current menu. ### Method POST ### Endpoint /api/menu/push-submenu/details ### Parameters #### Request Body - **actionId** (int) - Required - A unique identifier for the action. - **labelStr** (string) - Required - The raw label of the menu item (will be localized). - **iconName** (string) - Required - The icon of the menu item. ### Response #### Success Response (200) - **MenuBuilder** (MenuBuilder) - The MenuBuilder instance. ### Request Example ```json { "actionId": 3, "labelStr": "Sub Menu Item", "iconName": "submenu_icon" } ``` ### Response Example ```json { "MenuBuilder": "// MenuBuilder object" } ``` ``` -------------------------------- ### GetLastAncestorOfType Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.VisualElementExtensions.html Gets the last ancestor of a given type for a VisualElement. ```APIDOC ## GetLastAncestorOfType ### Description Get the last ancestor of a given type. ### Parameters #### Path Parameters - **view** (VisualElement) - Required - The VisualElement object. ### Response - **Returns** (T) - The last ancestor of the given type. ``` -------------------------------- ### Implement Store Service for MVVM Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/state-management.html Create a service to manage the store, providing access to the Store instance. This service can be registered as a singleton. ```csharp public interface IStoreService { Store Store { get; } } public class StoreService { public Store Store { get; } public StoreService() { Store = StoreFactory.CreateStore( /* ... */ ); } } ``` -------------------------------- ### GetGrabModeUssClassName Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.Canvas.html Gets the USS class name for a given GrabMode. ```APIDOC ## GetGrabModeUssClassName(GrabMode) ### Description Gets the USS class name for a given GrabMode. ### Method `static string` ### Parameters #### Path Parameters - **enumValue** (GrabMode) - Required - The GrabMode enum value. ``` -------------------------------- ### DefaultEnhancer(DefaultEnhancerConfiguration) Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Redux.StoreFactory.html Get the default enhancer for the store. ```APIDOC ## POST /api/users ### Description Gets the default enhancer for the store. ### Method POST ### Endpoint /api/users ### Parameters #### Path Parameters - **cfg** (DefaultEnhancerConfiguration) - Optional - The configuration for the default enhancer. ### Request Body ```json { "cfg": { "someSetting": "value" } } ``` ### Response #### Success Response (200) - **enhancer** (StoreEnhancer) - The default enhancer. #### Response Example ```json { "enhancer": "function" } ``` ``` -------------------------------- ### AppUISetup Class Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Editor.AppUISetup.html The AppUISetup class is a static class used to add App UI Shaders to the GraphicsSettings PreloadedShaders list. It is marked with the InitializeOnLoad attribute, indicating it runs automatically when Unity loads. ```APIDOC ## Class AppUISetup ### Description This class is used to add the App UI Shaders to the GraphicsSettings PreloadedShaders list. ### Namespace Unity.AppUI.Editor ### Assembly Unity.AppUI.Editor.dll ### Syntax ```csharp [InitializeOnLoad] public static class AppUISetup { } ``` ### Inheritance - object - AppUISetup ### Inherited Members - object.Equals(object) - object.Equals(object, object) - object.GetHashCode() - object.GetType() - object.MemberwiseClone() - object.ReferenceEquals(object, object) - object.ToString() ``` -------------------------------- ### Argument Value Property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Navigation.Argument.html Gets the value of the navigation argument. ```csharp public string value { get; } ``` -------------------------------- ### Initialize UIToolkitHost Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.MVVM.UIToolkitHost.html Constructor for creating a new instance of UIToolkitHost. ```csharp public UIToolkitHost(UIDocument uiDocument) ``` -------------------------------- ### Begin Macro Method Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Undo.UndoStack.html Starts the composition of a macro command. Nested calls are supported but require matching EndMacro calls. ```csharp public void BeginMacro(string name) ``` -------------------------------- ### Argument Name Property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Navigation.Argument.html Gets the name of the navigation argument. ```csharp public string name { get; } ``` -------------------------------- ### Initialize StoryBookEnumProperty Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/migrate.html Comparison of the legacy non-generic initialization versus the updated generic approach for StoryBookEnumProperty. ```csharp var enumProperty = new StoryBookEnumProperty( nameof(Button.variant), (btn) => ((Button)btn).variant, (btn, val) => ((Button)btn).variant = (ButtonVariant)val); ``` ```csharp var enumProperty = new StoryBookEnumProperty( nameof(Button.variant), (btn) => ((Button)btn).variant, (btn, val) => ((Button)btn).variant = val); ``` -------------------------------- ### Draggable startPosition Property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.Draggable.html The starting world position of the drag operation. ```csharp public Vector2 startPosition { get; } ``` -------------------------------- ### GetOrientationClassName Method Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.TouchSlider-1.html Gets the USS class name for a given direction. ```APIDOC ## GetOrientationClassName(Direction) ### Description Gets the USS class name for a given direction. ### Method public static string GetOrientationClassName(Direction enumValue) ### Parameters - **enumValue** (Direction) - Required - The direction enum value. ### Returns - **string** - The USS class name. ``` -------------------------------- ### Implement MVVM Architecture Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/claude-plugin.html Set up MVVM patterns including dependency injection and ViewModels. ```text Set up an AppBuilder with dependency injection for a todo list app. Create a TodoViewModel with observable properties and commands. ``` ```text /app-ui:app-ui-mvvm Set up MVVM for a todo list app ``` -------------------------------- ### PushSubMenu (Action) Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.MenuBuilder.html Creates an action menu item, adds a sub-menu to the current menu, and makes it the current menu. ```APIDOC ## POST /api/menu/push-submenu/action ### Description Creates an action menu item, adds a sub-menu to the current menu, and makes it the current menu. ### Method POST ### Endpoint /api/menu/push-submenu/action ### Parameters #### Request Body - **bindItemFunc** (Action) - Required - A callback to bind the action. ### Response #### Success Response (200) - **MenuBuilder** (MenuBuilder) - The MenuBuilder instance. ### Remarks When the binding callback is invoked, the sub-menu is already pushed on the stack and set on the menu item. ### Request Example ```json { "bindItemFunc": "// Action binding callback" } ``` ### Response Example ```json { "MenuBuilder": "// MenuBuilder object" } ``` ``` -------------------------------- ### Manage fill property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.Thumb.html Gets or sets the fill color for the thumb. ```csharp public Color fill { get; set; } ``` -------------------------------- ### Register Services by Environment and Platform Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/mvvm-di.html Configure service implementations based on Unity editor status or platform capabilities. ```csharp // Debug vs production implementations services.AddSingletonWhen(typeof(IPaymentProcessor), typeof(MockPaymentProcessor), ctx => Application.isEditor); services.AddSingletonWhen(typeof(IPaymentProcessor), typeof(StripePaymentProcessor), ctx => !Application.isEditor); // Platform-specific implementations services.AddTransientWhen(typeof(IInputHandler), typeof(MobileInputHandler), ctx => Application.isMobilePlatform); services.AddTransientWhen(typeof(IInputHandler), typeof(DesktopInputHandler), ctx => !Application.isMobilePlatform); ``` -------------------------------- ### VisualElement Context Management Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.RangeSliderInt.html Methods for getting and providing context for VisualElements. ```APIDOC ## GetContext ### Description Retrieves a context of a specific type from a VisualElement. ### Method Extension Method ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response None ## GetContext ### Description Retrieves a context of a specific type and name from a VisualElement. ### Method Extension Method ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response None ## ProvideContext ### Description Provides a context of a specific type and name for a VisualElement. ### Method Extension Method ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response None ## ProvideContext ### Description Provides a context of a specific type for a VisualElement. ### Method Extension Method ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response None ``` -------------------------------- ### VisualElement Context Management Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.SVSquare.html Methods for getting and providing context for VisualElements. ```APIDOC ## GetContext ### Description Retrieves a context of a specific type for a VisualElement. ### Method Extension Method ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response None ## GetContext ### Description Retrieves a context of a specific type and name for a VisualElement. ### Method Extension Method ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response None ## ProvideContext ### Description Provides a context of a specific type for a VisualElement. ### Method Extension Method ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response None ## ProvideContext ### Description Provides a context of a specific type and name for a VisualElement. ### Method Extension Method ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response None ``` -------------------------------- ### Implement Navigation Lifecycle Methods Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Navigation.INavigationScreen.html Methods for handling navigation entry and exit events. ```csharp void OnEnter(NavController controller, NavDestination destination, Argument[] args) ``` ```csharp void OnExit(NavController controller, NavDestination destination, Argument[] args) ``` -------------------------------- ### Build Method Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.Tray.html Creates a new instance of a Tray component associated with a reference view and content. ```csharp public static Tray Build(VisualElement referenceView, VisualElement content) ``` -------------------------------- ### sortingOrder Property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.Popup-1.html Gets the current sorting order value for the popup. ```csharp public int sortingOrder { get; } ``` -------------------------------- ### Draggable dragDirection Property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.Draggable.html Gets or sets the direction of the drag operation. ```csharp public Draggable.DragDirection dragDirection { get; set; } ``` -------------------------------- ### Customizing Screen Instantiation with NavHost.makeScreen Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/changelog/CHANGELOG.html Customize how `NavigationScreen` instances are created by setting a callback to `NavHost.makeScreen`. This is useful for dependency injection scenarios. ```csharp NavHost.makeScreen ``` -------------------------------- ### Create a Store with slices Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/state-management.html Initializes a store using the StoreFactory to manage multiple state slices. ```csharp using Unity.AppUI.Redux; record MyState {} var store = StoreFactory.CreateStore(new [] { StoreFactory.CreateSlice( "mySlice", new MyState(), builder => { /* ... */ }, ), }); ``` -------------------------------- ### ColorWheel Saturation Property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.ColorWheel.html Gets or sets the saturation of the color wheel. ```csharp public float saturation { get; set; } ``` -------------------------------- ### ColorWheel Brightness Property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.ColorWheel.html Gets or sets the brightness of the color wheel. ```csharp public float brightness { get; set; } ``` -------------------------------- ### Build and Show a Popover Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/overlays.html Use the Popover.Build method to create and configure a popover element. The Show() method displays the popover. Various configuration options are available for placement, appearance, and interaction. ```csharp var popover = Popover.Build(target, content) .SetPlacement(placement) .SetShouldFlip(shouldFlip) .SetOffset(offset) .SetCrossOffset(crossOffset) .SetArrowVisible(showArrow) .SetContainerPadding(containerPadding) .SetOutsideClickDismiss(outsideClickDismissEnabled) .SetModalBackdrop(modalBackdrop) .SetKeyboardDismiss(keyboardDismissEnabled); popover.Show(); ``` -------------------------------- ### VisualElement Self Context Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.BottomNavBar.html Methods for getting context directly from a VisualElement itself. ```APIDOC ## VisualElementExtensions.GetSelfContext ### Description Retrieves a context value of a specific type directly from the VisualElement itself. ### Method `VisualElementExtensions.GetSelfContext(VisualElement element)` `VisualElementExtensions.GetSelfContext(VisualElement element, string key)` ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp VisualElement myElement = ...; MyContextData data = VisualElementExtensions.GetSelfContext(myElement); MyContextData namedData = VisualElementExtensions.GetSelfContext(myElement, "dataKey"); ``` ### Response #### Success Response (200) - **contextData** (T) - The context data, or null if not found on the element itself. #### Response Example ```json { "contextData": "" } ``` ## VisualElementExtensions.GetSelfContextProvider ### Description Retrieves a context provider of a specific type directly from the VisualElement itself. ### Method `VisualElementExtensions.GetSelfContextProvider(VisualElement element)` `VisualElementExtensions.GetSelfContextProvider(VisualElement element, string key)` ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp VisualElement myElement = ...; MyContextProvider provider = VisualElementExtensions.GetSelfContextProvider(myElement); MyContextProvider namedProvider = VisualElementExtensions.GetSelfContextProvider(myElement, "uniqueKey"); ``` ### Response #### Success Response (200) - **provider** (T) - The context provider instance, or null if not found on the element itself. #### Response Example ```json { "provider": "" } ``` ``` -------------------------------- ### Get State Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Redux.StoreExtensions.html Retrieves the state of a slice or a selected part of the state. ```APIDOC ## GetState(IStateProvider, string) ### Description Get the state of a slice. ### Method GET ### Endpoint /websites/unity3d_packages_com_unity_dt_app-ui_2_2 ### Parameters #### Path Parameters None #### Query Parameters - **sliceName** (string) - Required - The name of the slice. #### Request Body - **store** (IStateProvider) - Required - The store to dispatch the action to. ### Request Example ```json { "store": "..." } ``` ### Response #### Success Response (200) - **TSliceState** (TSliceState) - The state of the slice. #### Response Example ```json { "state": "..." } ``` ### Exceptions - **ArgumentNullException**: Thrown when the store is null. - **ArgumentNullException**: Thrown when the sliceName is null or empty. ``` ```APIDOC ## GetState(IStateProvider, string, Selector) ### Description Get the selected part of the state in a slice. ### Method GET ### Endpoint /websites/unity3d_packages_com_unity_dt_app-ui_2_2 ### Parameters #### Path Parameters None #### Query Parameters - **sliceName** (string) - Required - The name of the slice. #### Request Body - **store** (IStateProvider) - Required - The store. - **selector** (Selector) - Required - The selector to get the selected part of the state. ### Request Example ```json { "store": "...", "selector": "..." } ``` ### Response #### Success Response (200) - **TSelected** (TSelected) - The selected part of the state. #### Response Example ```json { "selectedState": "..." } ``` ### Exceptions - **ArgumentNullException**: Thrown when any of the arguments is null. ``` ```APIDOC ## GetState(IStateProvider, Selector) ### Description Get a selected part of the state. ### Method GET ### Endpoint /websites/unity3d_packages_com_unity_dt_app-ui_2_2 ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **store** (IStateProvider) - Required - The store. - **selector** (Selector) - Required - The selector to get the selected part of the state. ### Request Example ```json { "store": "...", "selector": "..." } ``` ### Response #### Success Response (200) - **TSelected** (TSelected) - The selected part of the state. #### Response Example ```json { "selectedState": "..." } ``` ### Exceptions - **ArgumentNullException**: Thrown when the store is null. ``` -------------------------------- ### Access Services from App Class Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/mvvm-sample.html Demonstrates retrieving registered services directly within the App class initialization. ```csharp public class MyApp : App { public override void InitializeComponent() { base.InitializeComponent(); // Access services directly from the app var myService = services.GetRequiredService(); var anotherPage = services.GetRequiredService(); rootVisualElement.Add(services.GetRequiredService()); } } ``` -------------------------------- ### AppUIBuildSetup Class Overview Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Editor.AppUIBuildSetup.html The AppUIBuildSetup class is responsible for adding AppUISettings to preloaded assets during the Unity build process. ```APIDOC ## Class: Unity.AppUI.Editor.AppUIBuildSetup ### Description Unity build processor that adds AppUISettings object to preloaded assets. Implements IPreprocessBuildWithReport, IPostprocessBuildWithReport, and IOrderedCallback. ### Properties - **callbackOrder** (int) - Callback order used internally by Unity. ### Methods #### OnPreprocessBuild(BuildReport report) Called before the build starts. - **report** (BuildReport) - Unity Build report. #### OnPostprocessBuild(BuildReport report) Called after the build finishes. - **report** (BuildReport) - Unity Build report. ``` -------------------------------- ### isRunning Property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.MVVM.AsyncRelayCommand.html Gets the CancellationTokenSource that can be used to cancel the asynchronous operation. ```csharp public bool isRunning { get; } ``` -------------------------------- ### isCancellationRequested Property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.MVVM.AsyncRelayCommand.html Gets the CancellationTokenSource that can be used to cancel the asynchronous operation. ```csharp public bool isCancellationRequested { get; } ``` -------------------------------- ### HostApplication Method Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.MVVM.IUIToolkitHost.html Hosts the application using the provided IUIToolkitApp and IServiceProvider. ```APIDOC ## HostApplication(IUIToolkitApp, IServiceProvider) Hosts the application. ### Declaration ```csharp void HostApplication(IUIToolkitApp app, IServiceProvider serviceProvider) ``` ### Parameters | Type | Name | Description | |-----------------|-----------------|------------------| | IUIToolkitApp | app | The app to host. | | IServiceProvider| serviceProvider | The service provider to use. | ``` -------------------------------- ### executionTask Property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.MVVM.AsyncRelayCommand.html Gets or sets the Task that represents the asynchronous operation. ```csharp public Task? executionTask { get; set; } ``` -------------------------------- ### Implement OnConfiguringApp Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.MVVM.UIToolkitAppBuilder-1.html Lifecycle method triggered when the application builder is being configured. ```csharp protected virtual void OnConfiguringApp(AppBuilder builder) ``` -------------------------------- ### Build Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.MenuBuilder.html Creates a MenuBuilder instance, used for initializing a new menu. ```APIDOC ## POST /api/menu/build ### Description Creates a MenuBuilder instance. ### Method POST ### Endpoint /api/menu/build ### Parameters #### Request Body - **referenceView** (VisualElement) - Required - The reference view to position the menu. - **menu** (Menu) - Optional - The menu to display. ### Response #### Success Response (200) - **MenuBuilder** (MenuBuilder) - The MenuBuilder instance. ### Exceptions - **ArgumentNullException**: If `referenceView` is null. ### Request Example ```json { "referenceView": "// VisualElement object", "menu": "// Menu object" } ``` ### Response Example ```json { "MenuBuilder": "// MenuBuilder object" } ``` ``` -------------------------------- ### canBeCancelled Property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.MVVM.AsyncRelayCommand.html Gets the CancellationTokenSource that can be used to cancel the asynchronous operation. ```csharp public bool canBeCancelled { get; } ``` -------------------------------- ### Implement INavVisualController Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/migrate.html Navigation properties have moved to DefaultDestinationTemplate, and a new SetupNavigationRail method is required. ```csharp public class MyNavController : INavVisualController { public void SetupBottomNavBar(BottomNavBar bottomNavBar, NavDestination destination, NavController navController) { if (destination.showBottombar) { /* ... */ } } public void SetupAppBar(AppBar appBar, NavDestination destination, NavController navController) { if (destination.showAppBar) { /* ... */ } } public void SetupDrawer(Drawer drawer, NavDestination destination, NavController navController) { if (destination.showDrawer) { /* ... */ } } } ``` ```csharp public class MyNavController : INavVisualController { public void SetupBottomNavBar(BottomNavBar bottomNavBar, NavDestination destination, NavController navController) { if (destination.destinationTemplate is DefaultDestinationTemplate defaultTemplate && defaultTemplate.showBottombar) { /* ... */ } } public void SetupAppBar(AppBar appBar, NavDestination destination, NavController navController) { if (destination.destinationTemplate is DefaultDestinationTemplate defaultTemplate && defaultTemplate.showAppBar) { /* ... */ } } public void SetupDrawer(Drawer drawer, NavDestination destination, NavController navController) { if (destination.destinationTemplate is DefaultDestinationTemplate defaultTemplate && defaultTemplate.showDrawer) { /* ... */ } } public void SetupNavigationRail(NavigationRail navigationRail, NavDestination destination, NavController navController) { if (destination.destinationTemplate is DefaultDestinationTemplate defaultTemplate && defaultTemplate.showNavigationRail) { // Set up the navigation rail // You can access the destination and navController to customize the navigation rail } } } ``` -------------------------------- ### AnimateViewOut method Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.UI.AnchorPopup-1.html Starts the exit animation for the popup based on the dismissal reason. ```csharp protected override void AnimateViewOut(DismissType reason) ``` -------------------------------- ### Build and Show a Menu Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/overlays.html Use the MenuBuilder fluent API to construct a menu with actions and submenus. The Show() method displays the menu. Event handlers can be attached to menu items. ```csharp MenuBuilder.Build(anchor) .AddAction(123, "An Item", "info", evt => Debug.Log("Item clicked")) .PushSubMenu(456, "My Sub Menu", "help") .AddAction(789, "Sub Menu Item", "info", evt => Debug.Log("Sub Item clicked")) .PushSubMenu(3455, "Another Sub Menu", "help") .AddAction(7823129, "Another Sub Menu Item", "info", evt => Debug.Log("Other Item clicked")) .Pop() .Pop() .Show(); ``` -------------------------------- ### Access DateRange properties Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Core.DateRange.html Properties to retrieve the start and end dates of the range. ```csharp public Date end { get; } ``` ```csharp public Date start { get; } ``` -------------------------------- ### Define the App Entry Point Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/manual/mvvm-sample.html The main entry point class for the application, used to initialize components and define the root UI. ```csharp public class MyApp : App { public new static MyApp current => (MyApp)App.current; public override void InitializeComponent() { base.InitializeComponent(); rootVisualElement.Add(services.GetRequiredService()); } public override void Shutdown() { // Called when the app is shutting down } } ``` -------------------------------- ### Undo Limit Property Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Undo.UndoStack.html Gets or sets the maximum memory capacity for the stack. ```csharp public ulong undoLimit { get; set; } ``` -------------------------------- ### Navigation Screen Methods Source: https://docs.unity3d.com/Packages/com.unity.dt.app-ui%402.2/api/Unity.AppUI.Navigation.NavigationScreen.html Methods for handling screen lifecycle events and setting up UI components. ```APIDOC ## Methods ### `OnEnter(NavController controller, NavDestination destination, Argument[] args)` Called when the screen is pushed to a NavHost. #### Declaration ```csharp public virtual void OnEnter(NavController controller, NavDestination destination, Argument[] args) ``` #### Parameters - **controller** (NavController) - Required - The NavController that manages the navigation stack. - **destination** (NavDestination) - Required - The NavDestination associated with this screen. - **args** (Argument[]) - Required - The arguments associated with this screen. ### `OnExit(NavController controller, NavDestination destination, Argument[] args)` Called when the screen is popped from a NavHost. #### Declaration ```csharp public virtual void OnExit(NavController controller, NavDestination destination, Argument[] args) ``` #### Parameters - **controller** (NavController) - Required - The NavController that manages the navigation stack. - **destination** (NavDestination) - Required - The NavDestination associated with this screen. - **args** (Argument[]) - Required - The arguments associated with this screen. #### Remarks This method is called before the screen is removed from the NavHost. ### `SetupAppBar(AppBar appBar, NavController controller)` Implement this method to setup the AppBar of this screen specifically. #### Declaration ```csharp protected virtual void SetupAppBar(AppBar appBar, NavController controller) ``` #### Parameters - **appBar** (AppBar) - Required - The AppBar to setup. - **controller** (NavController) - Required - The NavController that manages the navigation stack. #### Remarks To setup the AppBar globally, use SetupAppBar(AppBar, NavDestination, NavController) in your implementation of INavVisualController. ### `SetupBottomNavBar(BottomNavBar bottomNavBar, NavController controller)` Implement this method to setup the BottomNavBar of this screen specifically. #### Declaration ```csharp protected virtual void SetupBottomNavBar(BottomNavBar bottomNavBar, NavController controller) ``` #### Parameters - **bottomNavBar** (BottomNavBar) - Required - The BottomNavBar to setup. - **controller** (NavController) - Required - The NavController that manages the navigation stack. #### Remarks To setup the BottomNavBar globally, use SetupBottomNavBar(BottomNavBar, NavDestination, NavController) in your implementation of INavVisualController. ### `SetupDrawer(Drawer drawer, NavController controller)` Implement this method to setup the Drawer of this screen specifically. #### Declaration ```csharp protected virtual void SetupDrawer(Drawer drawer, NavController controller) ``` #### Parameters - **drawer** (Drawer) - Required - The Drawer to setup. - **controller** (NavController) - Required - The NavController that manages the navigation stack. #### Remarks To setup the Drawer globally, use SetupDrawer(Drawer, NavDestination, NavController) in your implementation of INavVisualController. ### `SetupNavigationRail(NavigationRail navigationRail, NavController controller)` Implement this method to setup the NavigationRail of this screen specifically. #### Declaration ```csharp protected virtual void SetupNavigationRail(NavigationRail navigationRail, NavController controller) ``` #### Parameters - **navigationRail** (NavigationRail) - Required - The NavigationRail to setup. - **controller** (NavController) - Required - The NavController that manages the navigation stack. #### Remarks To setup the NavigationRail globally, use SetupNavigationRail(NavigationRail, NavDestination, NavController) in your implementation of INavVisualController. ```