Search Unity

give 2 clients network authority over 1 GameObject.

Discussion in 'Scripting' started by timoshaddix, Sep 29, 2016.

  1. timoshaddix

    timoshaddix

    Joined:
    Jan 7, 2014
    Posts:
    64
    Hello,

    I'm creating a project which has 1 gameobject, and 2 network clients,
    The idea is that the gameobject is a small fire. and as soon as i press "S" the fire needs to grow in size.
    So i checked if(isServer && hasSpawned == false) and as soon as the server runs it spawns the fire and sets hasSpawned to true, so on the client another fire won't spawn, since i only need 1 general fire.

    i made a [SyncVar] bool with MayGrow, and if that's true, it will be growing.
    The only problem now is, that the client has no authority over the gameobject, thus can't do anything with the fire.

    is there a way to give both authority?

    greetings,
    Timo
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    just to clarify, the clients need to be able to call a function on the fire that the server authored ("MakeFireGrow" or whatever), not spawn a new fire?