Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: heavygunner on February 20, 2021, 08:53:09 PM

Title: [SOLVED] PUN 2 - Duplicate View ID found
Post by: heavygunner 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
Title: Re: PUN 2 - Duplicate View ID found
Post by: djaydino 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 (https://hutonggames.fogbugz.com/default.asp?W1181)
Title: Re: PUN 2 - Duplicate View ID found
Post by: heavygunner on February 22, 2021, 04:49:28 AM
Fixed it by destroying Paymaker Photon Proxy proxy after disconnected and before load main menu

Title: Re: [SOLVED] PUN 2 - Duplicate View ID found
Post by: Omninorm on February 22, 2021, 07:59:56 AM
Thanks for posting the answer :)