ClientRpc Function not being carried out on all clients in Unity3d c#

Updated on June 4, 2017 in [A] Multiplayer
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
0 on June 4, 2017

Currently I am working on a networked 2d platformer game. I have a script that is supposed to instantiate the players jetpack called JetpackManager. However when the player is spawned into the scene the code only spawns a jetpack into the hosts scene and not into the clients’ scenes. This results in only the hosts scene working properly while all the players in the clients’ scenes have no jetpacks. This is my code for the JetpackManager:

using UnityEngine;
using UnityEngine.Networking;

public class JetpackManager : NetworkBehaviour {

private Jetpack[] jetpacks;

private Transform jetPackHold;

private PlayerController playerController;

private Jetpack currentJetpack;

void Start(){
    playerController = GetComponent<PlayerController> ();

    if (isLocalPlayer) {
        CmdEquipJetpack (0);

void CmdEquipJetpack(int jetpackNumber){
    RpcEquipJetpack (jetpackNumber);

void RpcEquipJetpack(int jetpackNumber){

    if (currentJetpack != null) {
        Destroy (currentJetpack.gameObject);

    currentJetpack = Instantiate (jetpacks[jetpackNumber], jetPackHold.position, jetPackHold.rotation);
    currentJetpack.transform.SetParent (jetPackHold);

    playerController.InitialiseJetpackVariables (currentJetpack);


So essentially my problem is that the code within the RpcEquipJetpack Function is for some reason only being called on the host and not on any of the clients.

  • Liked by