playMaker

Author Topic: [SOLVED] PUN 2 - Duplicate View ID found  (Read 4834 times)

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
[SOLVED] PUN 2 - Duplicate View ID found
« on: February 20, 2021, 08:53:09 PM »
Hi,

I used PUN load level action to load the level scene. Then, when round finished, I use Load Level Num action to load the Main menu.

I have Playmaker Photon Proxy prefab in Main Menu scene only

I got this error on console once it loaded Main Menu

Quote
PhotonView ID duplicate found: 1. New: View 1 on PlayMaker Photon Proxy (scene) old: View 1 on PlayMaker Photon Proxy (scene). Maybe one wasn't destroyed on scene load?! Check for 'DontDestroyOnLoad'. Destroying old entry, adding new.
UnityEngine.Debug:LogError(Object)
Photon.Pun.PhotonNetwork:RegisterPhotonView(PhotonView) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1003)
Photon.Pun.PhotonView:Awake() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:590)

Quote
InvalidOperationException: Duplicate key 1
ExitGames.Client.Photon.NonAllocDictionary`2[K,V].Add (K key, V val) (at <55327f06489f4ebdb665a4707c165dbb>:0)
Photon.Pun.PhotonNetwork.RegisterPhotonView (Photon.Pun.PhotonView netView) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1014)
Photon.Pun.PhotonView.Awake () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:590)

Couldn't figure it out
« Last Edit: February 22, 2021, 04:49:51 AM by heavygunner »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: PUN 2 - Duplicate View ID found
« Reply #1 on: February 21, 2021, 06:16:17 AM »
HI.
I haven't used pun yet, but i did have some similar issues.

The Playmaker Photon Proxy might have a Don't destroy on load.
you can see this when you play and a scene is created, called Dont Destroy on load.

If so setting the object as a singleton might help.
This will make sure that there will be only 1 version of that object.(oldest object persist)
Search for singleton manager on the Ecosystem

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
Re: PUN 2 - Duplicate View ID found
« Reply #2 on: February 22, 2021, 04:49:28 AM »
Fixed it by destroying Paymaker Photon Proxy proxy after disconnected and before load main menu


Omninorm

  • Playmaker Newbie
  • *
  • Posts: 33
Re: [SOLVED] PUN 2 - Duplicate View ID found
« Reply #3 on: February 22, 2021, 07:59:56 AM »
Thanks for posting the answer :)