PhotonView on iOS does not communicate with other platforms

Hi,

I'm using PUN v2.35 and Unity 2020.3.36f1.

Recently I built an existing game working on Android and Unity editor on iOS. All things work well except for PhotonViews. PhotonView messages generated on iOS are not received by other platforms and vice versa, but other iOS devices can receive those messages well. It seems like the messages are filtered by the PUN server. Is there any special setting could lead to this issue?

Any help is appreciated.

Best Answer

Answers

  • There is no filtering like that. Photon enables cross platform games by default.

    Check if all clients are in the same room. E.g. show the room name and the player count.

    Is there any error in the logs maybe?

    Unrelated: Update PUN please. Your version is old.

  • Thank you for the reply Tobias.

    There is an error like the following:

    Failed to find a PhotonView with ID=1 for incoming OwnershipUpdate event (newOwnerActorNumber=4), sender=4. If you load scenes, make sure to pause the message queue.

    I checked photon view IDs and actor numbers of the players in the room on both platforms and they all match. All players are in the same room because they can send rpc events to each other without problems.

    I tried debugging Photon3Unity3D.dll and found that commands of type NCommand.CT_SENDUNRELIABLE are not received.

  • Unreliable commands may get lost, yes. RPCs and ownership transfers are not unreliable.

    The key issue is that somehow the PhotonView 1 is not existing at the receiving client. Maybe you didn't load the correct scene yet? Maybe somehow the object got destroyed? This is what you need to debug.

    This doc includes a section about Timing For RPCs And Loading Levels. That applies here maybe.

  • I found that iOS never send the messages out. The original problem description is incorrect.

    The root cause is that in PhotonView there is a serialized field "ObservedComponentsFoldoutOpen" only available in Unity editor. Somehow on iOS devices it leads to an error like "A scripted object has a different serialization layout when loading." and make PhotonView fail to initialize.

  • What is the callstack of that error?

  • arthurcc
    arthurcc
    edited September 2022 Answer ✓

    The error was from Unity and I did not pay much attention to the calklstack. The details related to this issue could be found here: https://answers.unity.com/questions/1288797/a-script-behaviour-has-a-different-serialization-l.html.