ExtendRealityLtd / VRTK

An example of how to use the Tilia packages to create great content with VRTK v4.
https://www.vrtk.io/
MIT License
3.69k stars 993 forks source link

InvalidOperationException thrown on UnTouching InteractorColliderActivator in Farm Scene #2018

Closed NilsBernatzki closed 5 years ago

NilsBernatzki commented 5 years ago

Environment

VRTK v4 beta master commit hash: 0161a4fc1187a24f0d6f70cdcba25dbae79ade3d Unity 2018.3 Vive

Steps to reproduce

Play the ExampleScene. Go to the Warehouse and try to move the WarehouseDoor by touching the Up/Down Buttons next to the door.

On touching the InteractorColliderActivator - GameObject, the AvatarTrackedColliders - GameObject gets activated. On untouching the InteractorColliderActivator - GameObject, the AvatarTrackedColliders - GameObject gets deactivated. I think this to be able to push the buttons with Non-Trigger Colliders.

Expected behavior

No Errors.

Current behavior

Error thrown by each Interactor on untouching the InteractorColliderActivator:

InvalidOperationException: Collection was modified; enumeration operation may not execute. System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) (at :0) System.Collections.Generic.List1+Enumerator[T].MoveNextRare () (at <d7ac571ca2d04b2f981d0d886fa067cf>:0) System.Collections.Generic.List1+Enumerator[T].MoveNext () (at :0) Zinnia.Tracking.Collision.CollisionNotifier.OnCollisionStopped (Zinnia.Tracking.Collision.CollisionNotifier+EventData data) (at Assets/VRTK/Dependencies/Zinnia.Unity/Runtime/Tracking/Collision/CollisionNotifier.cs:283) Zinnia.Tracking.Collision.CollisionTracker.OnTriggerExit (UnityEngine.Collider collider) (at Assets/VRTK/Dependencies/Zinnia.Unity/Runtime/Tracking/Collision/CollisionTracker.cs:117)

Comment

I reproduced the Error in an own scene with the same setup. I noticed, that once the ActiveCollisionsContainer of the InteractorColliderActivator GameObject doesn't call SetActive() in the FirstStarted(EventData) Event on the AvatarTrackedColliders GameObject, the Error doesn't occur. So maybe the Collision between the AvatarTrackedColliders and the Interactors causing the error.

Thank you and greetings!