Search Unity

Problem with SyncVars

Discussion in 'Multiplayer' started by Scornz, Nov 30, 2016.

  1. Scornz

    Scornz

    Joined:
    Jun 15, 2014
    Posts:
    27
    Hello,

    I've recently picked up UNET in an attempt to implement multiplayer into my game. It's been going smoothly until I've recently encountered a problem that makes absolutely no sense to me... here's the situation:

    This script is all on a cube, not the player

    I have a SyncVar called isGrabbed that calls the hook JustGrabbed()

    When the object is grabbed it requests client authority from the player object and sends a Command setting isGrabbed to true or false.

    isGrabbed (being a SyncVar) calls the hook which does a bunch of other stuff (including setting isGrabbed to the desired value)...

    Here's the problem, the command is being called correctly and isGrabbed is set correctly on the server, but the SyncVar seems to not be working, as none of the clients are calling the hook function and/or updating isGrabbed...

    Any help would be very much appreciated :)
     
  2. Scornz

    Scornz

    Joined:
    Jun 15, 2014
    Posts:
    27
    *Bump*
     
  3. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    You should probably post your code