title: If Statement doesn't work when I build my game on Unity
body: <p>I am trying to learn how to develop a 2D game in Unity. I would like to level up the scene when the user completes the scoring task. For example, in the first scene, the user must shoot 5 balls to skip to the second level. I have a score counter which counts down scores. </p>
  
  <p>Here is the related function which I called it in the <code>Update()</code> body:</p>
  
  <pre><code>    void GetScore() 
  {
      if (KickTheBall.timeLeft &lt;= 0 ) {
          SceneManager.LoadScene ("GameOver");
      }
          else if (ScoreTask &lt;= 0)
      {
          Debug.Log (nextScene.name);
          LevelUp ();
      }
  }
  </code></pre>
  
  <p><code>LevelUp()</code> function:</p>
  
  <pre><code>void LevelUp()
      {
          SceneManager.LoadScene (nextScene.name);
      }
  </code></pre>
  
  <p>On iMac Pro everything works properly, however, when I build it on Xcode, the value of the scoreboard falls below zero instead of skipping to the next level.</p>
  
  <p>These are the log outputs from Xcode:</p>
  
  <pre><code>NullReferenceException: A null value was found where an object instance was required.
    at Ball.GetScore () [0x00000] in &lt;filename unknown&gt;:0 
  
  (Filename: currently not available on il2cpp Line: -1)
  
  -&gt; applicationDidEnterBackground()
  </code></pre>
  
  <p>I think I set all scenes properly:</p>
  
  <p><a href="https://i.stack.imgur.com/Hw3cr.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Hw3cr.jpg" alt="Please click here to check the scenes"></a></p>
  
  <p>You can see the scoreboard on the left corner:</p>
  
  <p><a href="https://i.stack.imgur.com/gQt5g.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gQt5g.jpg" alt="enter image description here"></a></p>
  
  <p>How can I fix this problem? Why it happens only on mobile?</p>