Search Unity

Problem if Network identity false

Discussion in 'Multiplayer' started by Who-am-I, Dec 25, 2015.

  1. Who-am-I

    Who-am-I

    Joined:
    Mar 29, 2014
    Posts:
    73
    Hi
    Sorry for my bad English

    I have a uGUI button with Network identity. I am sending ClientRpc after click on this button. Its not working if I keep false initially.

    suppose I have two buttons

    Button A
    Button B

    both button has network identity and sending ClientRpc.
    Button B is SetActive false(in Editor mode also).
    After click button A, button B will be true on all the client screen(its working fine).
    But after click on button B my code is not send ClientRpc.


    I have to keep false button B. There is any way ???
     
  2. Who-am-I

    Who-am-I

    Joined:
    Mar 29, 2014
    Posts:
    73
    no answer ?? :(:(:(:(
     
  3. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    I imagine you may have more chance of some advice if you post your code (in code tags). It's impossible to help otherwise.
     
  4. Who-am-I

    Who-am-I

    Joined:
    Mar 29, 2014
    Posts:
    73
    Thank you @Munchy2007
    There is a simple code for change color of all connected client via server.
    I create a cube
    I add NetworkIdentity component and
    I add my simple script
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Networking;
    3.  
    4. public class ClickOnCube : NetworkBehaviour
    5. {
    6.     public void OnMouseDown()
    7.     {
    8.         if (isServer)
    9.         {
    10.             RpcChangeObjectColor();
    11.         }
    12.     }
    13.  
    14.     [ClientRpc]
    15.     public void RpcChangeObjectColor()
    16.     {
    17.         transform.GetComponent<Renderer>().material.color = Color.red;
    18.     }
    19. }