PUNVoice: Attempt to create multiple instances of PhotonVoiceSettings
in Photon Voice
PUNVoice: Attempt to create multiple instances of PhotonVoiceSettings.
Why? How to solve this?
Why? How to solve this?
0
Comments
-
Hi @StyleMaster,
Thank you for choosing Photon!
Which PUNVoice version do you use?
if it's not the latest please update as this issue was fixed already.
Otherwise please do tell us how to reproduce it and if you have more Unity console logs.
Do you attach PhotonVoiceSettings to multiple scenes or to prefabs?0 -
@JohnTube I'm also noticing this error. My Photon Voice looks to be 1.91.
My setup: I have a prefab in the scene which has the PhotonVoicesettings attached as a component. Setting a break in PhotonVoiceSettings, i'm seeing that Resources.FindObjectsOfTypeAll is returning 2 versions of my prefab, with one of them having `isActiveAndEnabled` true, while the other has this false. Am I doing something incorrect in my setup?
Thanks,
Adam0 -
@mr_bulldops,
Your report is very good.
Indeed, we do not support PhotonVoiceSettings in prefabs but we will change this.
Try changingResources.FindObjectsOfTypeAll
withFindObjectsOfType
it will ignore inactive and non scene objects.0 -
@StyleMaster @mr_bulldops
fix will be available in next version.
until then you can try updating PhotonVoiceSettings class code as follows:/// <summary> /// Get current settings. /// </summary> public static PhotonVoiceSettings Instance { get { if (instance == null) { instance = PhotonVoiceNetwork.instance.gameObject.AddComponent<PhotonVoiceSettings>(); } return instance; } private set { if (instance != value) { if (instance != null && value != null) { Debug.LogErrorFormat(value, "PUNVoice: PhotonVoiceSettings instance already set, extra instance ignored."); return; } instance = value; } } } // for settings put in scene in editor void Awake() { lock (instanceLock) { Instance = this; } }
0