Bug Reporting > PlayMaker Bug Reporting
Photon Simple Connection error [Solved]
(1/1)
jrDev:
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
jeanfabre:
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:
--- Quote from: jeanfabre on August 22, 2019, 01:24:04 AM ---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
--- End quote ---
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:
Hello,
I have also solved this by changing the line 193 Foreach into just a for loop.
FROM
--- Code: ---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++;
}
--- End code ---
TO
--- Code: ---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;
}
}
--- End code ---
Jean if you can take a look at this and fix it officially it would be great!
Thanks,
jrDev
jeanfabre:
Hi,
Something is odd indeed, I don't get that here. Will look into this.
Bye,
Jean
Navigation
[0] Message Index
Go to full version