docs.unity3d.com
    Show / Hide Table of Contents

    Using App UI

    Once you have installed App UI Unity Package, you can start using it in your Unity projects.

    App UI Panel - The root context for all App UI components

    In order for App UI components to be displayed correctly, they must be fed with an ApplicationContext object. This object is defines some properties that can affect the component's look and feel, such as the current theme, the current language, and the current screen size. This ApplicationContext object is provided by a ContextProvider component.

    To know more about Context management, see the Context documentation page.

    The application will also need to have a special layering system to display UI elements on top of the app's content, such as a dialog box or a popup menu.

    The Panel component is a special ContextProvider that provides a default ApplicationContext object, based on the current system information, and a layering system to handle popups, notifications, and tooltips.

    It is highly recommended to use the Panel component as the root component of your application.

    Here is an example of usage inside your UI Document:

    <UXML xmlns="UnityEngine.UIElements" xmlns:appui="UnityEngine.Dt.App.UI">
        <appui:Panel>
            <!-- Your UI elements -->
        </appui:Panel>
    </UXML>
    

    App UI Components

    App UI components are defined as VisualElement in UI Toolkit. You can find them in the UnityEngine.Dt.App.UI namespace.

    If you are working directly by editing UXML files, we recommend to define the appui namespace inside. You can also update the UXML Schema definition to get autocompletion in your IDE by selecting Assets > Update UXML Schema in the Editor.

    Here is an example of usage inside your UI Document:

    <UXML xmlns="UnityEngine.UIElements" xmlns:appui="UnityEngine.Dt.App.UI">
        <appui:Panel>
            <appui:Button title="Hello World!" />
        </appui:Panel>
    </UXML>
    

    App UI Hello World

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023