Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

PUN 2 and Unity Addressables?

Discussion in 'Connected Games' started by strongbox3d, Aug 1, 2020.

  1. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    816
    Hello guys,

    I am trying to use addressables to add new weapons and items from a remote AWS after the game is launched, to my multiplayer game using PUN 2 but since PhotonNetwork.Instantiate method uses the resources folder to load gameobjects from, and this folder doesn't let you mark gameobjects as addressables, I haven't being able to find any documentation or online material addressing this issue... Does anyone here knows how to use PUN 2 with addressables? or where to find documentation/guides/ or tutorials about this subject?

    Regards,
    Carlos
     
    JKeyber likes this.
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,433
    In PUN 2, the pool used by Instantiate can be replaced. As long as the pool knows how to identify and load the instances, you are not locked to the resources folder.
    We did not experiment a lot with the addressables but it's possible to use them. The only tricky part would be that our network Instantiate does not allow async loading, at the moment. So you need to load the assets earlier or you instantiate some impostor object, which gets instantiated instead and replaced as soon as the correct one is loaded.

    Have a look at the IPunPrefabPool and how it's used. Assing via PhotonNetwork.PrefabPool.
     
    JKeyber likes this.
  3. JKeyber

    JKeyber

    Joined:
    Apr 9, 2019
    Posts:
    3
    I also encountered this problem. When I create a simple object and control it through PUN, PhotonView will lose ViewID
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,433
    We need a repro. Prepare a minimal project with what you do, describe it and mail us the download link: developer@photonengine.com. We need to understand the situation to work on it.
     
  5. JKeyber

    JKeyber

    Joined:
    Apr 9, 2019
    Posts:
    3
    Thank you I have sent a demo
     
  6. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,433
    Just got the ticket assigned. It may take a bit, as I am on vacation until Monday. Maybe a colleague can have a look but overall, I guess it's my topic.
    Thanks for the sample. Will update you by mail.
     
  7. JKeyber

    JKeyber

    Joined:
    Apr 9, 2019
    Posts:
    3
    I received your reply, which helped me a lot. You are a great team. I will consult you again if I encounter problems. Thank you very much.
     
  8. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    816
    Hello tobiass,

    It would be very helpful if you would post updates here since it will help everyone who has the same sort of problem.

    Regards,
    Carlos
     
unityunity