Search Unity

Local Health Bar value being sent over network!! ??

Discussion in 'Multiplayer' started by Barry100, Nov 21, 2014.

  1. Barry100

    Barry100

    Joined:
    Nov 12, 2014
    Posts:
    200
    hi all...
    when I set up a canvas and use Image.FillAmount the Image.FillAmount is being sent over the network and eveyones healthbar is resizing when I get shot ?

    any idea how to stop this ?
     
  2. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Do you have a way to uniquely identify each player in the network? Maybe you can broadcast an ID with the health bar value being sent, and then only have a client apply the change if the ID matches theirs.

    I am pretty sure RPCs have a way to target a specific client, but if you're already doing that and there's a bug, try including an ID. If it's the case that you are sending to a specific user, maybe you're forgetting to check the networkview in your healthbar script.
    Code (CSharp):
    1. if(networkView.isMine == false)
    2. {
    3.      //do nothing
    4. }
     
  3. Barry100

    Barry100

    Joined:
    Nov 12, 2014
    Posts:
    200
    cheers im going to check this out right now

    just had a though aftert reading yoru code - ive kinda been doing this all day but in a slightly different way!
     
  4. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Good luck, and don't stress out since 4.6 is still a buggy beta right now AND we're getting new networking options sometime in 5.x! :D