The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

How to properly load one player to another scene?

2023-03-01 14:16:24

Hello everyone

I'm having some issues with my multiplayer game regarding loading scenes. I've come across a few similar questions already, but everything I tried didn't seem to work.

The flow to join multiplayer in the game is as follows:

  • player has to click a button to join the game

  • when clicked, I connect the player to the servers using:

    private static void ConnectToMasterServer() {

  • once connected, I join the player to the lobby using:

    private static void JoinLobby() {

  • when connected, I try to load the player in a random room. If failed (which means that there is no room or none room available for it to enter) it will create a new room to join, allowing for other players to join as well

  • when the room is created, I load the level that I want to put them in using:


when OnJoinedRoom callback is fired, I instantiate a new player with a prefab using

  • PhotonNetwork.Instantiate()

So far so good, the game is working as expected, all players that join are there, I can see them and it seems to be working properly. The problems begins when I try to load a new scene from there to only one player. I have a trigger area in a part of the map the will load the player to another scene (while keeping multiplayer). To do that, I'm using the same PhotonNetwork.LoadLevel(_sceneToLoad).

I'm aware that there is the AutomaticallySyncScene flag and that it will sync the scene of the Master Client to all other clients, but it's set to falsesince I would like to allow players to load on their own.

The problem is, when a non Master Client load this new scene, I start receiving this warning:

Received OnSerialization for view ID xxxx. We have no such photon view. Ignore this if you're joining or leaving a room. State: Joined.

The game doesn't seem to break anywhere and everything seems to be working, but I think this could potentially break the game somehow

Additional Information:

I'm using DontDestroyOnLoad()

  • on the players, so they don't lose their Photon View's Ids when loading a new scene

  • Players can return to the original scene after loading the trigger I talked about. The warning seems to show up only when the Master Client is in a different scene compared to the rest of the players

  • When the player triggers the scene to load, I set the following:

PhotonNetwork.IsMessageQueueRunning = false;

and set it back to True

  • when the new scene is loaded

If there is some other information I forgot to share, please let me know

Using Unity & Photon PUN

Thanks in advance for any help


2023-03-01 15:31:43

Admittedly, this is a tricky topic for PUN and I think the solution in Fusion is better but .. let's see if we can make it work.

Overall, PUN is independent from whatever scene you load, unless your scenes contain PhotonView components. Then those must be unique via the viewID assigned in the scene.

If you want players to go somewhere and load a fitting scene, you want to avoid scene networked objects, because only a few users will load and know them.

You don't have to use PhotonNetwork.LoadLevel. As long as you don't sync a single scene, there is no benefit.

I think the missing bit is that you need to apply DontDestroyOnLoad on all characters, not only the local one.

Or .. you could load the scenes additive and unload the scenes which you don't need anymore. As long as you can make sure Unity doesn't destroy objects you loaded with some scene, you should get there.

On another note: Don't join a lobby, unless you must list rooms. You can join a random room without ever joining a lobby.

Also, you could use ConnectUsingSettings, relying on the PhotonServerSettings. Directly connecting to a Master Server is not going to be supported forever. Use the Name Servers. You can define a region or set a Region Whitelist for the app with just one region, so you don't have to worry about ending up in different ones.

2023-03-01 19:50:34

First of all, thank you @Tobias for the enlightenment, it really helped my to get an idea of what was going on here.

I think I undersdant the problem now, I have in the other scene networked objects, and as you said, only a few players will know about them, which makes the others players on the other scene receives packages from "ghost" objects, which triggers the warning.

I applied your tips, but this particular warning seems not to be resolved unfortunatly. I'll see what I can do, maybe redesign the scene to avoid networked objects or just try to put them all together in just one scene, unsless there is another way to load different networked scenes using PUN.

Also, I'll check it out about Fusion, maybe the best approach is to change to it.

Again, thanks for the answer, it really helped :)

2023-03-02 14:22:11

Glad I could help somewhat. I hope this is also going to be useful:

The error tells you the ViewId of the object causing issues. If it's below 1000, it is a scene ViewId and you still load something on only a few clients. If it's 1000+, the ViewId is instantiated by some player.

You could create a scene which only holds the networked objects and is loaded additively.

You could try to put the scene objects into an Interest Group per loaded scene. Clients should subscribe to that Group while they have the scene loaded. Potential problem: Scene objects moving to some place that is technically another scene...

Back to top