Author Topic: UICheckbox multiplayer NetworkView/RPC updates  (Read 2550 times)

outerringz

  • Guest
UICheckbox multiplayer NetworkView/RPC updates
« on: May 28, 2013, 09:57:07 AM »
I've been trying, without success, to get NGUI components to update across the network in a multiplayer game.

For my testing, I've been using a UICheckbox and trying to get the checkbox.isChecked status to update for two players connected via networking.

I have tried placing NetworkView components and setting the Observed to UICheckbox, UIButton, and to the checkmark's UIsprite script. I've also tried placing my OnClick() code in an RPC method and calling that method from the OnClick().

  1. void OnClick()
  2. {
  3.         networkView.RPC("PlayerSelected", RPCMode.All);
  4. }
  5.  
  6. [RPC]
  7. void PlayerSelected()
  8. {
  9.         if (checkbox.isChecked)
  10.         {
  11.                 checkbox.isChecked = true;
  12.                 gameSetupScript.playerHost = playerClass;
  13.         }
  14.         else
  15.         {
  16.                 checkbox.isChecked = false;
  17.                 gameSetupScript.playerHost = PlayerClass.None; 
  18.         }
  19. }
  20.  

Any help anyone can offer is appreciated.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UICheckbox multiplayer NetworkView/RPC updates
« Reply #1 on: May 28, 2013, 02:56:02 PM »
There is a reason I wrote TNet... there are so many little issues with the built-in networking systems... sometimes functions don't get called, and it's up to you to determine all the cases of why this may not happen. For example buffered calls on dynamically instantiated objects don't work at all. I'm afraid I can't be of much help with the built-in networking. This is, after all, a forum for NGUI.

outerringz

  • Guest
Re: UICheckbox multiplayer NetworkView/RPC updates
« Reply #2 on: May 28, 2013, 05:20:35 PM »
I just bought TNet, I'll check it out.