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
- Standalone Player crashes with "TDerived GetOrLoad<TDerived>() where TDerived : T" when IL2CPP Code generation is set to "Faster (smaller) Builds"
- IndexOutOfRangeException and InvalidOperationException when logging XML string
- Script missing in "Assets/Settings/Mobile_Renderer/GlobalVolumeFeature" of "com.unity.template.urp-blank" template
- “Font Asset Creator - Error Code [Invalid_File_Structure]…“ error is logged when generating Font Assets from fonts with meta files from previous Editor versions
- Input.mousePosition returns (NaN, NaN, 0.00) when Scene view is opened
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.