title: Position x and z isn't working for loading next scene, any ideas on why?
body: <p>I'm using unity HDRP and I'm trying to make a game where you go from the menu (which is a scene) to scene 1. After that every time you are within certain coordinates the next scene will be added. And at some point the first scene will be deleted. I have done this since it lags too much if I have just one scene with the whole map in it. I separated the map into 5 scenes which will load in so there is only 3 scenes at a time.</p>
  <pre><code>using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.SceneManagement;
  //using UnityEngine.UI;
  
  public class SceneLoaderScript : MonoBehaviour
  {
      public bool loadnextScene = false;
      public bool isLoaded2 = false;
      public bool isLoaded3 = false;
      public bool isLoaded4 = false;
      public bool isLoaded5 = false;
      public GameObject You;
  
      private void Start()
      {
          You = GameObject.Find(&quot;You&quot;);
      }
      private void Update()
      {
          Vector3 SceneLoaderPos = (You.transform.transform.position).normalized;
          if (SceneLoaderPos.x &gt; 38 &amp; SceneLoaderPos.x &lt; 62 &amp; SceneLoaderPos.z &gt; 42 &amp; SceneLoaderPos.z &lt; 44)
          {
              scene2();
          }
          if (SceneLoaderPos.x &lt; 16 &amp; SceneLoaderPos.x &gt; 70 &amp; SceneLoaderPos.z == 11)
          {
              scene3();
          }
          if (SceneLoaderPos.x &lt; 16 &amp; SceneLoaderPos.x &gt; 70 &amp; SceneLoaderPos.z == 11)
          {
              scene4();
          }
      }
      private void scene2()
      {
          Debug.Log(&quot;lol&quot;);
          if (isLoaded2 == false)
          {
              
              SceneManager.LoadScene(&quot;Scene 2&quot;, LoadSceneMode.Additive);
          }
          else if (isLoaded2 == true)
          {
              SceneManager.UnloadSceneAsync(&quot;scene 2&quot;);
          }
      }
      private void scene3()
      {
          if (isLoaded3 == false)
          {
              SceneManager.LoadScene(&quot;Scene 3&quot;, LoadSceneMode.Additive);
              SceneManager.UnloadSceneAsync(&quot;scene 1&quot;);
          }
          else if (isLoaded3 == true)
          {
              SceneManager.UnloadSceneAsync(&quot;scene 3&quot;);
          }
      }
      private void scene4()
      {
          if (isLoaded4 == false)
          {
              SceneManager.LoadScene(&quot;Scene 4&quot;, LoadSceneMode.Additive);
              SceneManager.UnloadSceneAsync(&quot;scene 1&quot;);
          }
          else if (isLoaded4 == true)
          {
              SceneManager.UnloadSceneAsync(&quot;scene 4&quot;);
          }
      }
  
  }
  </code></pre>
  <p>You load in scene 1 in an different script and this script is put on the character you play ( who is called You)</p>
  <p>any ideas why it isn't working? I tried to put in a Debug.Log(&quot;hi&quot;) in the scene2 function to see if it ever went in and nothing appeared.</p>