PUNVoice: Attempt to create multiple instances of PhotonVoiceSettings

PUNVoice: Attempt to create multiple instances of PhotonVoiceSettings.

Why? How to solve this?


  • 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?
  • @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?

  • @mr_bulldops,

    Your report is very good.
    Indeed, we do not support PhotonVoiceSettings in prefabs but we will change this.
    Try changing Resources.FindObjectsOfTypeAll with FindObjectsOfType it will ignore inactive and non scene objects.
  • @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 { 
                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.");
                    instance = value;
        // for settings put in scene in editor
        void Awake()
            lock (instanceLock)
                Instance = this;
Sign In or Register to comment.