docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method AddComponent

    AddComponent(GameObject, bool, bool)

    Adds a new UI components to the visualization canvas. Pass in fullscreen if the component should take up the entire screen. Pass in setAsLowestElement if the component should be rendered behind all other components. This method will return false if the element could not be added, true if everything works properly.

    Declaration
    public bool AddComponent(GameObject component, bool fullScreen = true, bool setAsLowestElement = false)
    Parameters
    Type Name Description
    GameObject component

    UI component that should be added to this UI canvas

    bool fullScreen

    Should this component's rect transform be set to fill the entire dimensions of the parent, defaults to true

    bool setAsLowestElement

    Should this UI component be rendered as the lowest UI component in the scene, defaults to false

    Returns
    Type Description
    bool

    True if the component was added properly, false if an error occurred.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)