Photon Network : InstantiateRoomObject vs InstantiateSceneObject

Options

Im making a game lets says like Co-op Pacman, where the score is Accumulated from each player, like if Player A eat 10 and Player B eat 7, the scoreboard would be 17 (10+7).

so in order to make this share scoreboard, i want to make a Neutral Object where every player can access it simultaneously, and player who just join get automatically synch with the scoreboard.

and i look at some of the PUN features and this features might solve my problem

1.InstantiateRoomObject

2.InstantiateSceneObject

i already see this documentation and idk what would be the best for my scenario

https://doc.photonengine.com/en-US/pun/current/gameplay/instantiation#networked_scene_objects

so how it works? and how it used for each features?

all i can imagine that the Object that instantiate is owned by MasterClient, so all i can think is that in order to other player who are not Master to access this Object is by RPC that targeted to Master, but if im doing that, what is the difference with PhotonNetwork.Instantiate? if it is the object get deleted when the player who owned it is quit, i could just RoomOptions.CleanupCacheOnLeave = false and the object would still be there if the owner quit.

Answers

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options

    Hi @anwpecirotan,

    Thank you for choosing Photon!

    InstantiateSceneObject is the old name of InstantiateRoomObject.

    The difference in naming, current state:

    scene object is a type of room object.

    room object is not owned by any player and controller by current master client (if any).

    scene object is not runtime instantiated, it's a GameObject already in the scene with a PhotonView attached to it. You don't call Instantiate for scene objects.