ClientSim
ClientSim copied to clipboard
InvalidOperationException: Collection was modified; enumeration operation may not execute.
This error message appears in the console when removing a remote player with ClientSim. The spawned remote player remains in the hierarchy and is not properly destroyed.
Afaik, it started happening since ClientSim 1.2.4
After doing some researches, it seems that the culprit loop can be found in UdonManager at line 871
I added an explicit ToList() as a workaround
public void RunEvent(string eventName, params (string symbolName, object value)[] eventParameters)
{
foreach (Dictionary<GameObject, HashSet<UdonBehaviour>> sceneUdonBehaviourDirectory in
_sceneUdonBehaviourDirectories.Values)
{
foreach (HashSet<UdonBehaviour> udonBehaviourList in sceneUdonBehaviourDirectory.Values.ToList())
{
foreach (UdonBehaviour udonBehaviour in udonBehaviourList)
{
if (udonBehaviour != null)
{
udonBehaviour.RunEvent(eventName, eventParameters);
}
}
}
}
}