How to wait to set PlayerPrefs?

Hello!

I am using an asset that sends all PlayerPrefs data to iCloud once they are updated. The problem is, that when the user for example collects a coin, the game instantly sends the data to iCloud and it creates a 0.5s delay each time it happens, but only once per level (first time).

Is it possible to “store” the playerprefs and then set them when a bool turns true?

Or do you have another solution for me? Thanks a lot in advance.

You can use a Coroutine.
Pseudocode:

if(CoinIsPickedUp) {
    StartCoRoutine(MyCoroutine(PlayerPref values you want to save));
}

IEnumerator MyCoroutine(PlayerPref values you want to save) {
     while(myBool == false) {
         yield return null;
     }
     //Save PlayerPref values you want to save
     yield return null;
}