Authority transfer
Last updated
Was this helpful?
Was this helpful?
public void OnRequest(ushort client)
{
var coherenceSync = target.GetComponent<CoherenceSync>();
// do some extra checks
// transfer authority
coherenceSync.TransferAuthority(client);
// or reject authority request
// coherenceSync.RejectAuthorityRequest(client);
}var coherenceSync = target.GetComponent<CoherenceSync>();
coherenceSync.RequestAuthority();// There Unity Events in CoherenceSync help us understand
// what happened with authority requests and act accordingly.
// called when the CoherenceSync entity becomes the simulation authority
public UnityEvent OnAuthorityGained;
// called when the CoherenceSync entity loses simulatino authority
public UnityEvent OnAuthorityLost;
// called when a request to assume authority over the CoherenceSync entity
// is rejected
public UnityEvent OnAuthorityTransferRejected;