Class CurrentPlayer
Utility class to access information about the multiplayer play mode player while in playmode.
Inherited Members
Namespace: Unity.Multiplayer.Playmode
Assembly: Unity.Multiplayer.Playmode.dll
Syntax
public static class CurrentPlayer
Properties
IsMainEditor
Indicates if the currently running player is the main editor.
Declaration
public static bool IsMainEditor { get; }
Property Value
Type | Description |
---|---|
bool | Returns true if the currently running player is the main editor |
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");
}