playMaker

Author Topic: Photon Simple Connection error [Solved]  (Read 400 times)

jrDev

  • Junior Playmaker
  • **
  • Posts: 54
    • View Profile
Photon Simple Connection error [Solved]
« on: August 21, 2019, 12:27:03 AM »
Hello,

I have been getting this error when trying to test the SimpleConnection demo:

InvalidOperationException: Collection was modified; enumeration operation may not execute.
System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) (at <a8ed250850854b439cedc18931a314fe>:0)
System.Collections.Generic.List`1+Enumerator[T].MoveNextRare () (at <a8ed250850854b439cedc18931a314fe>:0)
System.Collections.Generic.List`1+Enumerator[T].MoveNext () (at <a8ed250850854b439cedc18931a314fe>:0)
HutongGames.PlayMaker.Pun2.PlayMakerPhotonProxy.SanitizeGameObject (UnityEngine.GameObject go) (at Assets/PlayMaker PUN 2/Scripts/PlayMakerPhotonProxy.cs:193)
HutongGames.PlayMaker.Pun2.PlayMakerPhotonGameObjectProxy.Awake () (at Assets/PlayMaker PUN 2/Scripts/PlayMakerPhotonGameObjectProxy.cs:67)

Any ideas?

Thanks,
jrDev
« Last Edit: August 22, 2019, 08:55:16 PM by jrDev »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14819
  • Official Playmaker Support
    • View Profile
Re: Photon Simple Connection error
« Reply #1 on: August 21, 2019, 10:24:04 PM »
Hi,

 Please don't double posts, I deleted your other thread, instead bump this thread, thanks :)

First time I see this error.

Can you try on a fresh project, with just pun2 PlayMaker and this demo?

Bye,

 Jean

jrDev

  • Junior Playmaker
  • **
  • Posts: 54
    • View Profile
Re: Photon Simple Connection error
« Reply #2 on: August 22, 2019, 02:51:35 PM »
Hi,

 Please don't double posts, I deleted your other thread, instead bump this thread, thanks :)

First time I see this error.

Can you try on a fresh project, with just pun2 PlayMaker and this demo?

Bye,

 Jean
Hey,

Sorry I didn't mean to do that, I though if I put it in the General section it would be more noticed.

Anyways, I redownloaded everything in the new project and get the same error with the Simple Connection demo.

Thanks,
jrDev

jrDev

  • Junior Playmaker
  • **
  • Posts: 54
    • View Profile
Re: Photon Simple Connection error
« Reply #3 on: August 22, 2019, 07:42:44 PM »
Hello,

I have also solved this by changing the line 193 Foreach into just a for loop.

FROM
Code: [Select]
int i = 0;
foreach (Component _comp in _photonView.ObservedComponents)
{

if (_comp is PlayMakerFSM)
        {
                PlayMakerFSM fsm = (PlayMakerFSM)_comp;
                PlayMakerPhotonView synchProxy = _photonView.gameObject.AddComponent<PlayMakerPhotonView>();
                Debug.Log("switching observed <"+ i +">");
                synchProxy.observed = fsm;

                _photonView.ObservedComponents[i] = synchProxy;
                       
        }

        i++;
}

TO

Code: [Select]
for(int i = 0; i < _photonView.ObservedComponents.Count; i++)
{
Component _comp = _photonView.ObservedComponents[i];

if (_comp is PlayMakerFSM)
        {
                PlayMakerFSM fsm = (PlayMakerFSM)_comp;
                PlayMakerPhotonView synchProxy = _photonView.gameObject.AddComponent<PlayMakerPhotonView>();
                Debug.Log("switching observed <"+ i +">");
                synchProxy.observed = fsm;

                _photonView.ObservedComponents[i] = synchProxy;
                       
        }

}

Jean if you can take a look at this and fix it officially it would be great!

Thanks,
jrDev
« Last Edit: August 22, 2019, 07:47:49 PM by jrDev »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14819
  • Official Playmaker Support
    • View Profile
Re: Photon Simple Connection error [Solved]
« Reply #4 on: August 23, 2019, 12:15:26 AM »
Hi,

Something is odd indeed, I don't get that here. Will look into this.

Bye,

 Jean