out of sync error

Hi there

I’m trying to modify the value of a vector 3 variable that is stored in a dictionary, but when I do it, I get this strange error:

InvalidOperationException: out of sync
System.Collections.Generic.Dictionary`2+Enumerator[System.String,UnityEngine.Vector3].VerifyState …

Here is the line of code that does the updating, it runs in a standard loop that itterates through all the vector3’s in the userFormula class. Sorry, I know there are some info in this line that resides in other code, but I have tripple checked all the values and everything works as expected.

userFormulas.userVector3[pageList[pageIndex].curveName[i]] = new Vector3(GameObject.Find(pageList[pageIndex].curveName[i]).GetComponent<drawBezierCurve>().curVarValue, v3.Value.y, v3.Value.z);

Any help much appreciated!

bump, anyone?

Awfully convoluted statement you have there…

rip it to pieces and run each part on its own (in the loop)

svenskefan

Thanks, I have tried to breal it appart and run a number of Debug.Logs to verify everything else is correct and it is. I have also used a very simmilar loop to, in stead of modifying a vector3, modify and object’s property and that works fine! One thing I forgot to mention is that useFormulas is a dll assembly. Is it possible that I will need to run this in a seperate thread? Could that be what the “out of sync” means?

Thanks