Pointable Canvas menu in Unity stops working when user uses both hands or controllers
In the unity oculus interaction SDK there is a bug in the PointableCanvasModule
This is the ADB log
15:37:50.067 Unity InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.Dictionary`2+ValueCollection+Enumerator[TKey,TValue].MoveNext ()
at Oculus.Interaction.PointableCanvasModule.Process () [0x00000]
at UnityEngine.EventSystems.EventSystem.Update () [0x00000]
The result is the menu items are no longer selectable and the user has a stuck menu
Offending code:
public class PointableCanvasModule : PointerInputModule
////...
public override void Process()
{
foreach (Pointer pointer in _pointersForDeletion)
{
ProcessPointer(pointer, true);
}
_pointersForDeletion.Clear();
// when pointers/hand rays are added: InvalidOperationException: Collection was modified
foreach (Pointer pointer in _pointerMap.Values)
{
ProcessPointer(pointer);
}
}Proposed fix
var pointers = new List<Pointer>();
pointers.AddRange(_pointerMap.Values);
foreach (Pointer pointer in pointers)
ProcessPointer(pointer);
