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