Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Assign authority to server when Local Player Authority set true

Discussion in 'Multiplayer' started by fdsagizi2, May 30, 2018.

  1. fdsagizi2

    fdsagizi2

    Joined:
    Nov 4, 2013
    Posts:
    70
    Hi! How we can set Authority to server, when "Local Player Authority == true"?

    i mean:

    We set "Local Player Authority" to true, for cars objects. When we spawn car, on server hasAuthority == false
    When user inter Car, we make AssignClientAuthority(playerInCar) - on server hasAuthority == false
    When player leave car, we do - RemoveClientAuthority(playerInCar) and now - on server hasAuthority == true

    how we can make hasAuthority == true on server, after spawn?
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    You would set local player authority to false and spawn with NetworkServer.Spawn. When the object spawns, the server should have authority.
     
  3. fdsagizi2

    fdsagizi2

    Joined:
    Nov 4, 2013
    Posts:
    70
    if do so, when i try use AssignClientAuthority - unity say local player authority must be true