Guest User

Untitled

a guest
Oct 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. [Command]
  2. void Cmd_AssignLocalAuthority(GameObject obj)
  3. {
  4. print("shifting authority successfully");
  5. NetworkInstanceId nIns = obj.GetComponent<NetworkIdentity>().netId;
  6. GameObject client = NetworkServer.FindLocalObject(nIns);
  7. NetworkIdentity ni = client.GetComponent<NetworkIdentity>();
  8. ni.AssignClientAuthority(connectionToClient);
  9. }
  10.  
  11. [Command]
  12. void Cmd_RemoveLocalAuthority(GameObject obj)
  13. {
  14. print("reverting authority successfully");
  15. NetworkInstanceId nIns = obj.GetComponent<NetworkIdentity>().netId;
  16. GameObject client = NetworkServer.FindLocalObject(nIns);
  17. NetworkIdentity ni = client.GetComponent<NetworkIdentity>();
  18. ni.RemoveClientAuthority(ni.clientAuthorityOwner);
  19. }
Add Comment
Please, Sign In to add comment