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
Documentation

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.

Read More on
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 work with addressable x resources

jc_kolbapps
2021-06-02 19:47:19

Hi hi, I'm going to the adressables path to download content from my online game. Currently photon precasts should be in the resources folder. So how am I supposed to work here? Can someone give me some light?

Comments

Tobias
2021-06-03 07:59:16

Async loading is not supported by Instantiate. When anyone instantiates an object, each client needs a proxy for this.
What you could do, however, is have a "light" prefab for the networked object. This could then load the visuals and apply them as needed.

Implement a IPunPrefabPool and assign it as PhotonNetwork.PrefabPool. Make it load the addressables before they are needed and you can get rid of the Resources.

Check out the API reference for the IPunPrefabPool for details on what it must provide.

jc_kolbapps
2021-06-04 14:07:44

Hi Tobias, Thanks for responding. I understand the concept behind your idea. But I don't understand how to work with PunPool. I checked the documentation but didn't find anything practical to follow.

If I'm not asking too much, could you show me an example?
I currently have something very simple in my project:

1 - My room, start, instantiating the player:

2 - The prefab instantied from room (photonPlayer), is a empty prefab, only to choise a correct prefab for the player controller. So the photonPlayer prefab it will be to instantiate an other prefab. This other prefab will be to used for the player controller. Its a prefab with all that de player need, like as model, animations etc etc…

  • PhotonPlayer Instance:

Using your theory, I will make this prefab (from the player controller), to an empty container too, and it will be to instantiate a prefab of my addressable reference, with everything my player needs. This can really work. Right?

But, I had never heard of the photon pool until now. I don't understand where to implement this.
Using the code references above, where do I start working with the Pool?

Tobias
2021-06-09 10:17:04

Sorry for the late reply. I had a draft in the text field but didn't send.

There is actually also a doc on the pool (forgot to point out):
https://doc.photonengine.com/en-us/pun/current/gameplay/instantiation/#using_the_prefabpool

Well. Empty is not the correct wording. You need a core / skeleton prefab, which can fully handle network updates. It just doesn't need visuals and so on. Those can be loaded async and this is the benefit this gives you.

Alternatively, as said: Pre-load the assets you need for networking. You can do this from a pool.

Back to top