Allocate view ID for another player

Hi,

I want to create players objects on Master Client but i can't assign view ID for another players. Public method AllocateViewID can assing view ID only for a local player. Why? Is it bad practice to create objects for other players? Method AllocateViewID with ownerId parameter has private access...

Comments

  • Rusildo
    Rusildo
    edited December 2018
    And another problem with prefabs in Unity 2018.3.0f2. Field 'viewIdField' saved in runtime and i get error:
    AllocateViewID() can't be used for PhotonViews that already have a viewID. This view is: View 2

    Used code from here (Manual Instantiation):
    https://doc.photonengine.com/en-us/pun/v2/gameplay/instantiation
  • Hi @Rusildo,

    AllocateViewID only works on the local player. If you want to create an object for another player, you would have to instantiate that object with an attached PhotonView component locally, then use the AllocateViewID function and share this information with all other clients in the same room. After they have instantiated this object and assigned the given ViewID, too, you would have to transfer the Ownership to a certain client.

    Is there any reason why you don't want to use PhotonNetwork.Instantiate for Instantiation?

    In terms of the problems with the prefabs in 2018.3: if you use PUN 2, please update to version 2.5 or later. Version 2.5 added support for Unity 2018.3. If you use PUN Classic, you sadly have to wait for the next version, as we haven't added support for Unity 2018.3 yet.
  • Is there a timeline for when PUN Classic will support 2018.3? Thanks
  • I don't have an ETA, sorry.
  • I have exactly the same problem. It's not possible to use PhotonNetwork.Instantiate when you are instantiating different prefabs local and remote version. However when I create the remote prefab on the master client there is no way to pass the control to the other client (I have passed the remote player actorNumber and call TransferOwnership on the master but it doesn't work).

    Please check this thread if you can help
    https://forum.photonengine.com/discussion/16272/remote-avatar-created-by-master-cannot-be-controlled-by-remote-user/p1?new=1