docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method AddToggleControl

    AddToggleControl(string, UnityAction<bool>)

    Creates a new toggle control with passed in name. The passed in listener will be called on toggle clicks. If anything goes wrong this method will return null. Returns the control panel element upon a successful add.

    Declaration
    public GameObject AddToggleControl(string name, UnityAction<bool> listener)
    Parameters
    Type Name Description
    string name

    The name of the toggle

    UnityAction<bool> listener

    The callback action that will be triggered when the toggle's state changes

    Returns
    Type Description
    GameObject

    The created toggle

    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)