Networking Issue Client Side

Options
What could be the reason for client's transform not updating in master server?

These 4 RPCs has been called in my script. But still if a player in client-side move, it is not updating in server but server-side movements are updating in client. Somebody please help!

               if (PlayersInGame==1)
		{
			PhotonView.RPC("RPC_SpawnPlayerCamera",PhotonTargets.MasterClient);
			PhotonView.RPC("RPC_SpawnPlayers",PhotonTargets.MasterClient,id1);			
			PhotonView.RPC("RPC_AssignPlayerButtons",PhotonTargets.MasterClient);									
		}
		else if (PlayersInGame==PhotonNetwork.playerList.Length)
		{	
			PhotonView.RPC("RPC_SpawnTargets",PhotonTargets.MasterClient,id2);
			PhotonView.RPC("RPC_SpawnTargetCamera",PhotonTargets.Others);
			PhotonView.RPC("RPC_SpawnTargets",PhotonTargets.Others,id2);					
			PhotonView.RPC("RPC_AssignTargetButtons",PhotonTargets.Others);		
			PhotonView.RPC("RPC_SpawnPlayers",PhotonTargets.Others,id1);
			print("All players are in game");				
		}

Best Answers

  • degeta10
    degeta10
    Answer ✓
    Options
    Hey actually i found the problem. I used this function to spawn just one prefab when each player connects and its working. Because i used PhotonNetwork.Instantiate it worked. In my games script i manually spawn the players using just Instantiate method and its not wokring. So What should i do?
    [PunRPC]
    	private void RPC_SpawnPlayer(int id1)
    	{
    		float randomval=Random.Range(0f,5f);
    		PhotonNetwork.Instantiate(Path.Combine("Prefabs","Player"),Vector3.up*randomval+Vector3.right*randomval,Quaternion.identity,0);
    	}

Answers

  • degeta10
    degeta10
    Answer ✓
    Options
    Hey actually i found the problem. I used this function to spawn just one prefab when each player connects and its working. Because i used PhotonNetwork.Instantiate it worked. In my games script i manually spawn the players using just Instantiate method and its not wokring. So What should i do?
    [PunRPC]
    	private void RPC_SpawnPlayer(int id1)
    	{
    		float randomval=Random.Range(0f,5f);
    		PhotonNetwork.Instantiate(Path.Combine("Prefabs","Player"),Vector3.up*randomval+Vector3.right*randomval,Quaternion.identity,0);
    	}