docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method GetPlayerNameAsync

    GetPlayerNameAsync(bool)

    Returns the name of the logged in player if it has been set. If no name has been set, this will return null if autoGenerate is set to false. This will also cache the name locally.

    Declaration
    Task<string> GetPlayerNameAsync(bool autoGenerate = true)
    Parameters
    Type Name Description
    bool autoGenerate

    Option auto generate a player name if none already exist. Defaults to true

    Returns
    Type Description
    Task<string>

    Task for the operation with the resulting player name

    Exceptions
    Type Condition
    AuthenticationException

    The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

    • Throws with ErrorCode ClientInvalidUserState if the player is not authorized to perform this operation.
    RequestFailedException

    The task fails with the exception when the task cannot complete successfully.

    • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
    • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.
    In This Article
    Back to top
    Copyright © 2023 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)