Skip to content

Commit babb0ac

Browse files
authored
feat: NetworkBehaviour/NetworkIdentity 'isHost' (#4047)
1 parent e5f664d commit babb0ac

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Assets/Mirror/Core/NetworkBehaviour.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ public abstract class NetworkBehaviour : MonoBehaviour
6262
/// <summary>True if this object is on the client and has been spawned by the server.</summary>
6363
public bool isClient => netIdentity.isClient;
6464

65+
/// <summary>Returns true for spawned objects in host mode.</summary>
66+
public bool isHost => isServer && isClient;
67+
6568
/// <summary>True if this object is the the client's own local player.</summary>
6669
public bool isLocalPlayer => netIdentity.isLocalPlayer;
6770

Assets/Mirror/Core/NetworkIdentity.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ public sealed class NetworkIdentity : MonoBehaviour
8888
// => fixes https://github.com/vis2k/Mirror/issues/2533
8989
public bool isServer { get; internal set; }
9090

91+
/// <summary>Returns true for spawned objects in host mode.</summary>
92+
public bool isHost => isServer && isClient;
93+
9194
/// <summary>Return true if this object represents the player on the local machine.</summary>
9295
//
9396
// IMPORTANT:

0 commit comments

Comments
 (0)