IsHost
Namespace: SynicSugar.P2P
Class: p2pInfo
public bool IsHost ()
public bool IsHost (UserId targetId)
public bool IsHost (string targetId)
Description
If local or target user is host, return true.
When Host is disconnected from match, EOS switches Host to other user.
NetworkCommons has this same process in each class, so this is for other classes.
using SynicSugar.P2P;
using UnityEngine;
[NetworkPlayer]
public class p2pSample : MonoBehaviour {
[SyncVar] int gameTime;
public void CountGameTime(){
if(!p2pInfo.Instance.IsHost()){
return;
}
gameTime++;
}
}