Error on Magic Leap regarding Photon View ID

Options
Lisi
Lisi
Hi,

I have the following problem: I am implementing a multiplayer application with Photon 2 and Unity3D for the Magic Leap One. I have the following flow: First I show a menu, where a player can connect an opponent. When he selects the player, I load another scene. I am doing this between a PC and the glasses to be able to better test everything. When I load the second scene from the PC, everything is fine --> both the PC player and the glasses can play the game, but when I am loading the second scene from the glasses, then I instantly get back to the main menu and I am getting the following error:

: ArgumentException: An item with the same key has already been added. Key: 1
11-15 11:27:28.626 2674 1 E Unity : at UnityEngine.Playables.PlayableDirector.SendOnPlayableDirectorStop () [0x00000] in <00000000000000000000000000000000>:0
11-15 11:27:28.626 2674 1 E Unity : at UnityEngine.GridLayout.DoNothing () [0x00000] in <00000000000000000000000000000000>:0
11-15 11:27:28.626 2674 1 E Unity : at UnityEngine.GridLayout.DoNothing () [0x00000] in <00000000000000000000000000000000>:0
11-15 11:27:28.626 2674 1 E Unity : at UnityEngine.GridLayout.DoNothing () [0x00000] in <00000000000000000000000000000000>:0
11-15 11:27:28.626 2674 1 E Unity : at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x00000] in <00000000000000000000000000000000>:0
11-15 11:27:28.626 2674 1 E Unity : at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <00000000000000000000000000000000>:0
11-15 11:27:28.626 2674 1 E Unity : at Photon.Pun.PhotonNetwork.RegisterPhotonView (Photon.Pun.PhotonView netView) [0x00000] in <00000000000000000000000000000000>:0
11-15 11:27:28.626 2674 1 E Unity : at Photon.Pun.PhotonView.Awake () [0x00000] in <00000000000000000000000000000000>:0
11-15 11:27:28.626 2674 1 E Unity : at System.Collections.Generic.IReadOnlyDictionary`2[TKey,TValue].get_Keys () [0x00000] in <00000000000000000000000000000000>:0
11-15 11:27:28.626 2674 1 E Unity : at UnityEngine.GridLayout.DoNothing () [0x00000] in <00000000000000000000000000000000>:0
11-15 11:27:28.626 2674 1 E Unity : System.Diagnostics.StackTrace:init_frames(Int32, Boolean)
11-15 11:27:28.626 2674 1 E Unity : System.Diagnostics.StackTrace:.ctor(Int32, Boolean)
11-15 11:27:28.626 2674 1 E Unity : UnityEngine.StackTraceUtility:ExtractStringFromExceptionInternal(Object, String&, String&)
11-15 11:27:28.626 2674 1 E Unity : System.Collections.Generic.IReadOnlyDictionary`2:get_Keys()
11-15 11:27:28.626 2674 1 E Unity : UnityEngine.GridLayout:DoNothing()


Can anyone help me with this? I am using Unity 2019.2
Thanks a lot!

BR, Elisabeth

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited November 2019
    Options
    Hi @Lisi,

    Thank you for choosing Photon!

    The stack trace is strange.
    It does not make sense to me.

    I will try to ignore some of it and focus only on the few lines related to PUN.
    I have a hunch, I could be wrong and this could be totally unrelated to PUN and due to a Unity issue or some other UI issue in your project since I see GridLayout.

    Could you try something, in "Assets\Photon\PhotonUnityNetworking\Code\PhotonNetworkPart.cs", inside PhotonNetwork.RegisterPhotonView, line 875, replace:
    photonViewList.Add(netView.ViewID, netView);
    with:
    if (photonViewList.ContainsKey(netView.ViewID))
                {
                    Debug.LogErrorFormat("photonViewList still contains key {0}. Overriding it.", netView.ViewID);
                    photonViewList[netView.ViewID] = netView;
                }
                else
                {
                    photonViewList.Add(netView.ViewID, netView);
                }
    Also, make sure to check out other error logs in the console.
    As you should have seen one error line starting w/ "PhotonView ID duplicate found: ".