docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class CurrentPlayer

    Utility class to access information about the multiplayer play mode player while in playmode.

    Inheritance
    object
    CurrentPlayer
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Multiplayer.Playmode
    Assembly: Unity.Multiplayer.Playmode.dll
    Syntax
    public static class CurrentPlayer

    Methods

    ReadOnlyTags()

    Returns the tag(s) assigned to the currently running player.

    Declaration
    public static string[] ReadOnlyTags()
    Returns
    Type Description
    string[]

    Returns the array of assigned tags

    Examples
    void Update()
    {
        if (CurrentPlayer.ReadOnlyTags().Contains("YellowTeam")) {
            ...
        }
    }

    ReportResult(bool, string, string, int)

    This allows for asserting on the main editor from any Player (Useful for Runtime tests involving MonoBehaviour)

    Declaration
    public static void ReportResult(bool condition, string message = "", string callingFilePath = "", int lineNumber = 0)
    Parameters
    Type Name Description
    bool condition

    The Condition

    string message

    The Message

    string callingFilePath

    The Calling File Path

    int lineNumber

    The Line Number

    Examples
    void Update()
    {
        CurrentPlayer.ReportResult(Condition, "We successfully reported from a test");
    }
    In This Article
    • Methods
      • ReadOnlyTags()
      • ReportResult(bool, string, string, int)
    Back to top
    Copyright © 2025 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)