Search Issue Tracker
Active
Votes
4
Found in
5.6.0f3
Issue ID
1011778
Regression
No
[IAP] InvalidOperationException: Collection was modified; enumeration operation may not execute
Steps to reproduce:
1. Open user attached project
2. Go to Services tab and import the latest IAP package
3. Play the scene
4. Select a character to buy
5. Press "Buy"
6. Observe the "InvalidOperationException: Collection was modified" output in the console
Expected result: IAP should not throw "InvalidOperationException: Collection was modified" when an item is bought
Reproduced in: 2018.4.12f1; 2017.3.2f1, 2017.2.2p1, 2017.1.3p2, 5.6.5p2
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Inconsistent behaviour when interacting with different dropdown types with pointer events on parent Visual Element
- Hidden GameObjects won't re-enable when they have call "DontDestroyOnLoad" function
- Overlay Canvas are rendered on each split-screen camera when HDR is enabled
- [Android] The Player loses focus when using UnityEngine.Handheld.StartActivityIndicator() with Facebook SDK
- Build fails with "Building Library/Bee/artifacts/MacStandalonePlayerBuildProgram/gahcy/hj9mx3z/951.0 failed with output:..." errors when Scripting Backend is set to IL2CPP
hippogames
Nov 06, 2019 11:47
I just wonder why it can't be fixed. Just add ".ToList()" call inside foreach and close the bug!
DavidSof
Nov 07, 2018 21:13
Unity 2018.2.14f Using IAP version 1.20.1 ,appears to be due to disabling the GameObject the IAP Button is on as write(KIWASI) ,So to fix use StartCoroutine() and yield return new WaitForSeconds(0.25f) and than Button_ads.SetActive (false);
Michieal
Sep 13, 2018 08:46
Receiving this error in Unity 2018.2.6 Using IAP version 1.21.
In my case, it appears to be in the CodelessIAPListener trying to restore purchases at game start up.
Kiwasi
May 26, 2018 01:17
The error (at least on my system) appears to be due to disabling the GameObject the IAP Button is on during the success callback. Waiting one frame during the success callback before disabling the GameObject makes the problem go away.
toughlucksmith
Apr 04, 2018 14:25
I am also experiencing this issue on 2017.1.1f1 with most up to date Unity IAP. The problem goes away when I buy the second time.
This appears to only be an issue with interacting with the "fake" Unity store. I tested on iPhone and did not see this error in the debug log.