Attaching Manually Instantiated Object to the Player

I Instantiated Player Object using
PhotonNetwork.Instantiate.
which is seen by other user who join the room.The Player Object has the placement of Object which are chosen by user selected in Menu. In the Game Menu user can choose horses among 8 and character among 10 characters available. these chosen character and horse will be attached to the Instantiated player in corresponding position. I already have working copy of above method in single player mode without using photon network. Now i have attache these selected object to player. To do this I just manually Instantiated select object by following code

void SpawnPlayerAsset(int _id,Transform _trans)
{
int id1 = PhotonNetwork.AllocateViewID();
photonView.RPC("SpawnOnNetwork",
PhotonTargets.All,
_trans.position,
_trans.rotation,
_id);

}

[RPC]
void SpawnOnNetwork(Vector3 pos, Quaternion rot, int id1)
{
GameObject newPlayer = GameObject.Instantiate (chariotClone, pos, rot) as GameObject;
newPlayer.GetPhotonView ().viewID = id1;
newPlayer.transform.parent = gameObject.transform;

}

these instantiated object can't seem on the other players on this room. how could i solve this issue? This is my first project in MultiPlayer .

Comments

  • What is happening? Or what's not happening but should?
    Are there any log entries?
  • Parent Object : Instantiated from resource folder using PhotonNetwork.Instantiate.
    Child Object : Manual Instantiate and making it as child is not visible on the clients(or other devices).
    it throws log message twice with consecutive view ID in Client devices
    Warning message : " Received OnSerialization for view ID 2001. We have no such PhotonView! Ignored this if you're leaving a room. State: Joined
    UnityEngine.Debug:LogWarning(Object)"

    Thanks for immediate reply.
  • Which type of synchronization do you use in the PhotonView 2001?
    It might mean that a position update is discarded but it won't affect that the GO gets created. So: The GO should be created but maybe it's not at the place you expect it, if the update is reliable delta compressed AND the game object never moves.

    All of that is caused by a bug which we're fixing right now. I will post a message when the fix is live.