Buffered InstantiateSceneObject ?

Options
Hello,

I am currently develloping a game where in each scene, every player "registers" for the next scene, even if they are new players or just loading the scene. (I mean every time the game logic object is instantiated, you send an RPC AddPlayer)

The things is it works great when someone joins, but it just bugs when players load a scene.
After some bug testing, I developped a hack that delays the creation of this object, and it works.

I observed also that before I used the hack, the game logic object didn't even exist, so I concluded that method InstantiateSceneObject doesn't buffer (the doc say nothing about it).

However, after researching on this forum, I think it is in fact buffered.

So, what I'm actually asking is, does InstantiateSceneObject calls are stored in a buffer ?
If not, how can I make a buffered one ?
And if they are in fact, buffered, do you have an idea what is causing the problem ?

Thanks for taking the time to read this post.

Comments

  • Tobias
    Options
    InstantiateSceneObject is buffered, as is the "normal" PhotonNetwork.Instantiate. Difference is: The scene object stays buffered and "in the room" even if you leave. More exactly: If the player who instantiated something leaves, things get usually cleaned up for the remaining players and new players who join later on.

    The buffer is per room and not per scene. When you join a room, you get the instantiates done so far, no matter in which scene your client is. Unless you join the room again, your client will not get the instantiates again. This is not a problem if you just keep them until destroyed via network.
    The engine however will destroy objects from one scene when you load the next.

    I hope this explanation helps. You might want to keep some objects (via DontDestroyOnLoad) or you want to use a room per scene and simply switch rooms.
  • Thanks a lot, this function became a lot more clear for me.