IEnumerator WaitForAuthority(CommandNoArguments cmd) { if (!isServer) { GetAuthority(); NetworkIdentity netIdentity = GetComponent <NetworkIdentity>(); while (!netIdentity.hasAuthority) { yield return(new WaitForSeconds(0.01f)); } } cmd(); }
public Coroutine RunCommand(CommandNoArguments cmd) => StartCoroutine(WaitForAuthority(cmd));