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