title: Unity - is there a way to show the popup in my game only once per game session?
body: <p>[EDIT] Everything is working now! Thank's to @MrMoonMan!</p>
  <p>As the title says, I'm working on a mobile game and I just implemented a Check Update popup.</p>
  <p>The thing is, the popup is displayed every time the menu scene is loaded, and this is very annoying because if the player goes to the weapon menu and then comes back to the main menu 10 times, he will see the popup 10 times. The goal is to have the popup appear only once per game session, Here is what I tried for the moment but without success:</p>
  <ul>
  <li>Using a bool variable</li>
  <li>Destroy the gameobject to which the checkupdate script is attached when the user presses the &quot;No Thank's&quot; button</li>
  </ul>
  <p>Here is the code:</p>
  <pre><code>using System;
  using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.Networking;
  
  public class CheckUpdate : MonoBehaviour
  {
      public string versionUrl = &quot;&quot;;
      public string currentVersion;
      private string latestVersion;
      public GameObject newVersionAvailable;
      private static bool hasBeenChecked = false;
  
      void OnAwake()
      {
          DontDestroyOnLoad(this);
          StartCoroutine(LoadTxtData(versionUrl));
      }
  
      private IEnumerator LoadTxtData(string url)
      {
          UnityWebRequest loaded = new UnityWebRequest(url);
          loaded.downloadHandler = new DownloadHandlerBuffer();
          yield return loaded.SendWebRequest();
  
          latestVersion = loaded.downloadHandler.text;
          CheckVersion();
      }
  
      private void CheckVersion()
      {
          Debug.Log(&quot;currentVersion = &quot; + currentVersion);
          Debug.Log(&quot;latestVersion = &quot; + latestVersion);
  
          Version versionDevice = new Version(currentVersion);
          Version versionServer = new Version(latestVersion);
          int result = versionDevice.CompareTo(versionServer);
  
          if ((latestVersion != &quot;&quot;) &amp;&amp; (result &lt; 0))
          {
              newVersionAvailable.SetActive(true);
          }
  
          if (GetChecked())
              return;
      }
  
      public void ClosePopUp(GameObject obj)
      {
          obj.SetActive(false);
          Destroy(this);
      }
  
      public void OpenURL(string url)
      {
          Application.OpenURL(url);
      }
  
      public static bool GetChecked()
      {
          if (hasBeenChecked)
          {
              return hasBeenChecked;
          }
  
          hasBeenChecked = true;
          return false;
      }
  }
  </code></pre>