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.

Loading a scene with Unity's Addressable System

2021-08-06 09:57:41

The traditional PhotonNetwork.LoadLevel() method doesn't work in loading scenes using addressables, since it can only load scenes that are in the build settings (with SceneManager.LoadSceneAsync()). I was wondering if anybody knows how to Photon load a scene referenced in the addressable groups


2021-10-13 08:03:19

You have two options:

Have a look at the PUN code that loads the scene and update it to work with addressables. It should be possible to replace the Unity API that's used with the addressable equivalent.

Manually implement the loading, analog to what PUN does internally. Set a property, that contains the (addressable) scene name. When this changes, pause the message queue (IsMessageQueueRunning), load and re-enable the message queue when loading is done.

Sorry, I can't provide actual code for this.

2021-10-23 18:37:33

Okay, I've decided to just mix the two. I've set the location scene to load with addressables and the lobby and gameplay scene to load normally. However I also have a persistent managers scene, so I need to load additively. Photon load level methods by default don't do that, and when I change to load additively, the lobby scene is loaded multiple times (from OnJoinedRoom() and LoadLevelIfSynced()). So I turned off automatically sync scene, but now the OnJoinedRoom function won't work. Is there a way to solve this?

2021-10-25 16:21:35

There is always some way to solve these things. Not knowing your project or any more context, I can't speculate what's up, however.

Please let us know what this means:

OnJoinedRoom function won't work

2021-10-31 14:44:54

Oh sorry, what I mean is it doesn't get called. And that depends on whether automatically sync scene is on or off.

2021-11-12 05:39:54

It's a feature I'd expect to see supported in the future, is it on the roadmap, and if yes any estimate?

2021-11-16 09:34:13

We won't add support for Addressables to PUN, sorry.

Addressables are fully supported by Fusion, which we'd recommend for newer projects.

2021-11-26 09:54:45

Does PUN support addressables system?

Hello, I am using addressables with pun in my project. I want to load a scene from my asset bundle which is not included in build settings. I tried changing the photonnetwork.load level method. When a player tries to join the room he gets this error:

  • Scene Roomcreation couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded. To add a scene to the build settings use the menu File->Build Settings...

  • Here is my code

  • public static void LoadSceneAddressable(string levelName)

  • {

  • if (PhotonHandler.AppQuits)

  • {

  • return;

  • }

  • if (PhotonNetwork.AutomaticallySyncScene)

  • {

  • SetLevelInPropsIfSynced(levelName);

  • }

  • PhotonNetwork.IsMessageQueueRunning = false;

  • loadingLevelAndPausedNetwork = true;

  • Addressables.LoadSceneAsync(levelName, LoadSceneMode.Single);

  • }

2022-05-17 07:25:21

anyone found a solution? tq

2022-06-12 01:03:25

I can't seem to add the necessary libraries ie

using UnityEngine.AddressableAssets;

using UnityEngine.ResourceManagement.AsyncOperations;

using UnityEngine.ResourceManagement.ResourceProviders;

to the PhotonNetwork.cs

Tried modifying my own addressible scene load with toggling the  (IsMessageQueueRunning)

but getting duplicate players on my end.

Please add some level of support for this, or some hacky workaround... anything ... would mean so much :(

2022-06-14 12:37:17

Addressables support will not be added to PUN 2 anymore, as it is now in LTS / maintenance mode. Sorry.

You might want to look into Fusion for a much more capable solution (including Adressables support).

2022-06-22 17:46:44

This is crazy. We have to use addressables due to large apk sizes we cant submit our game to Google play because the apk is too large to keep the scenes in. Google now forces you to use Android App bundles which no longer support traditional apk uploading and expansion files for asset bundles. You now have to use addressables to bundle your assets seperately as far as I can see this is a crucial feature?

2022-06-23 10:53:59

I wasn't aware of that. While PUN 2 has no direct support of Addressables, it is not impossible to use them.

Part of the problem is: PUN will have to immediately instantiate networked objects, or the "target" may be missing for incoming updates (and then there is no way to handle incoming messages and they get lost or entirely out of order).

PUN 2 has the IPunPrefabPool, which you can use to create your own, Addressables-handling pool for instantiation. The condition is that you have to load Addressables before they are needed for instantiation. Aside from that, this will work very much "as usual" once the prefabs are known / loaded.

There are a few discussions about using the pool here and the reference docs explain how to use the lean API.

For loading Addressable scenes, you could manually pause the message queue as described in the docs or modify the PhotonNetwork.LoadLevel() code to fit your requirements.

2022-07-06 09:48:03


I would like to use addressable scenes with Fusion but I can't find how to proceed. I checked sample project about scene loading and doc but I don't understand how to implement it.

2022-08-03 12:17:18

You need to add the assembly reference for UnityEngine.Addressables and UnityEngine.ResourceManager to the assembly definition asset in the PhotonNetworking.cs folder. Only then it can be scoped in PhotonNetwork.cs

Back to top