title: Application freezes just after goin back from desktop to app (on android device)
body: <p>It tooks a lot of time to unfreeze (but sometimes it just crashes).</p>
  
  <p>I was debugging whole code to find a place where the problem is and I found that there's something wrong while I was saving things to Player Prefs.</p>
  
  <p>My "idea" why it is causing. Multiple times getting and setting prefs with different values.</p>
  
  <p>Test code:</p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  
  public class test : MonoBehaviour
  {
      [SerializeField]
      private Image bg;
      [SerializeField]
      private Text text;
  
      //private void Start()
      //{
      //    PlayerPrefs.SetString("dd", "x");
      //}
      //Update is called once per frame
  
      //bool was = false;
      int counter = 0;
      System.DateTime lastUpdate;
      bool active = false;
      List&lt;string&gt; tmp = new List&lt;string&gt;() { "5", "7" };
  
      private void Start()
      {
          lastUpdate = System.DateTime.UtcNow;
      }
  
      void Update()
      {
          System.DateTime now = System.DateTime.UtcNow;
          System.TimeSpan diff = now - lastUpdate;
          text.text = diff.ToString();
          if (diff.TotalSeconds &gt; 10)
          {
              active = !active;
              lastUpdate = now;
          }
  
          if (active)
          {
              bg.color = Color.green;
              //if ((System.DateTime.UtcNow - xyz).TotalSeconds &gt; 5)
              //if (counter &gt; 5)
              //{
              //if (!was)
              //{
              //    Debug.Log("XX_update");
              //}
  
              //was = true;
              //string x = PlayerPrefs.GetString("dd");
              for (int i = 0; i &lt; 20; i++)
              {
                  string x = PlayerPrefs.GetString("dd");
                  Set(5, i);
                  //string x = PlayerPrefs.GetString(CommonMethods.RandomString(5));
              }
              //}
              //else
              //{
              //    was = false;
              //    counter++;
              //}
          }
          else
          {
              bg.color = Color.red;
          }
      }
  
      private System.DateTime xyz = System.DateTime.UtcNow;
  
      public void OnApplicationFocus(bool focus)
      {
          counter = 0;
          Debug.Log("XX_onappfocus");
  
          xyz = System.DateTime.UtcNow;
      }
  
  
      public void Set(double value, int x = 0)
      {
          //PlayerPrefs.SetString(name, value.ToString("E3"));
          //string costam = random.NextDouble().ToString();
          //PlayerPrefs.SetString(name, costam);
          //UnityEngine.Debug.Log("XX_" + costam);
  
          //List&lt;string&gt; tmp = new List&lt;string&gt;() { "98754.38238715351", "98754.38238415351" };
          //string result = tmp.RandomElement();
          string result = tmp[x % 2];
          //PlayerPrefs.SetString(name, result);
          PlayerPrefs.SetString("dd", result);
          //PlayerPrefs.SetString(name, "1.054E+003");
      }
  }
  </code></pre>
  
  <p>I was thinking that maybe there's a problem with double's precision, but it wasn't. Then I checked if it is caused by parsing inside setstring methods, but it wasn't. Problem isn't connected with a key, so it can be random.</p>
  
  <p>If you want to check this try to build this code with 2 different values in tmp string list (now it's 5 and 7) and there will be bug, then change these values to the same (f.e. 5 and 5). Problem will disappear. Also you can delete get or set from FOR loop and problem will also disappear.</p>
  
  <p>I also made a tricky switch inside Update method to check if it is connected with this get / set pair so you can check it too.</p>
  
  <p>Sorry for my english guys but this problem is so complex that I even don't know how to describe it. I am trying to solve it for 3 days (we need to solve this or make a 'walk around' because we can't use that app without this).</p>
  
  <p>Thanks in advance.</p>