private GameObject SetViewIDs(ref GameObject go) { NetworkingPeer networkingPeer = PhotonNetwork.networkingPeer; PhotonView[] views = go.GetPhotonViewsInChildren(); //Debug.Log("Found " + views.Length + " photon views in " + go.name + " object and its children"); int[] viewIDs = new int[views.Length]; for (int i = 0; i < viewIDs.Length; i++) // ignore the main gameobject { //Debug.Log("Instantiate prefabName: " + prefabName + " player.ID: " + player.ID); viewIDs[i] = PhotonNetwork.AllocateViewID(); //Debug.Log("Allocated an id of " + viewIDs[i]); views[i].viewID = viewIDs[i]; views[i].instantiationId = viewIDs[i]; //Debug.Log("Assigning view id of " + viewIDs[i] + ", so now the view id is " + go.GetPhotonView().viewID + " for gameobject " + go.name); networkingPeer.RegisterPhotonView(views[i]); } return(go); }