PunRPC issues on build

Options

Hello,

I am using Pun 2 and I encountered a really weird behavior,

I have coded the RPC logic so it works great on the Unity editor, I have checked multiple times from different laptops - however, when I build an APK, it seems like the RPCs getting called sometimes, and sometimes not.

They are being called one time for sure, but after that, no more calls are being made.

What I've checked -

  1. The ServerSettings - refreshed the RPC list, didn't help.
  2. Checked the build logs from the device, nothing there.

I don't have any concrete info for diagnosing this case, but for sure there's unexpected/unwanted behavior in the build, since it's working perfectly in the editor, so checking the logic aspect of the code seems redundant.

What can cause such discrepancies between the editor and the build..?

EDIT:

I think the issue starts on this line:

this.photonView.RPC("UpdateBallValues", RpcTarget.Others, ballRB.position, ballRB.velocity, ballRB.angularVelocity);

After it's being called, the issue starts.

Thank you in advance,

Omer

Answers

  • So, apparently this issue is not related to Pun, but to using pun with addressables.

    It takes a custom implementation for instantiation and scene loading if you wanna work with Pun and Addressables, which is not the most straight-forward and clear, but I think I figured it out....

  • Tobias
    Tobias admin
    edited November 2022
    Options

    PUN does not support Addressables.

    A simple but not very "Addressables" way is to implement an instantiation pool which loads the assets before they are needed (when PUN calls to instantiate anything, it requires the object right away)...

    If you want to use them but don't do custom instantiation or implement a custom PUN instantiation pool, look into using Fusion.

    How did you solve it?