Question by 
               vanshika1012 · Mar 05, 2016 at 08:34 PM · 
                networkingmultiplayermultiplayer-networkingnetworkplayer  
              
 
              How can I send update to all clients from one client in Multiplayer game in Unity3d?
I have tried everything to implement this. I have two player and they both eat food. Host player is working fine, but when client eat it is not updating on host. I am using command attribute to update on server.
Please help.
Following is my code :-
 private void CmdCheckForFood(Vector3 snakePartPosToBeInitialize,Vector3 headPos)
 {
     
     if(_food != null)
     {
         if (_food.transform.position == headPos)
         {
             
             UiControllerCS.UI.showScore();
             _food.transform.position = GenerateRandomPosForFood(); // I am changing here position of food
             _food.GetComponent<NetworkTransform>().SetDirtyBit(1);
          //Following code will create another part of player if player eat the food.
             GameObject obj = Instantiate(snakePart, snakePartPosToBeInitialize, Quaternion.identity) as GameObject;
             currPartOfSnake += 1;
             obj.name = "" + currPartOfSnake;
             obj.transform.parent = gameObject.transform;
             tail.Add(obj);
             if(isLocalPlayer)
             NetworkServer.SpawnWithClientAuthority(obj , connectionToServer);
         }
     }
 }
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
RPC sending Failed 0 Answers
TrailRender not showing in all clients using Mirror networking 1 Answer
UNET Clients Laggy 0 Answers
How to decide an asynchronous multiplayer solution for a turn based mobile chess game? 0 Answers
Whats the best beginners tutorial for Photon Networking with Unity 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                