title: Disable script outside of the scene Unity 3D
body: <p>In my chess game, I have a scene of pieces choice - black or white. After the user clicks on one of the pawns he/she gets a popup message/ It looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/NZryt.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NZryt.jpg" alt="enter image description here"></a></p>
  
  <p>On Ok button click, the scene changes to the one with the board:</p>
  
  <p><a href="https://i.stack.imgur.com/fFoWr.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fFoWr.jpg" alt="enter image description here"></a></p>
  
  <p>When the user chose black pieces he/she should see them closer to him/her, while if the user chose white pieces, they should be at the front. By default, in my scene pieces which are closer are black. I tried to achieve this by adding a texture change script on each figure (they will differ for white and black pieces):</p>
  
  <pre><code>void Start () {
          GetComponent&lt;Renderer&gt;().material = Resources.Load&lt;Material&gt;)"Materials/Pieces/Marble/White Pawn");
      }
  </code></pre>
  
  <p>However, how can I disable this script when I redirect to the scene if the user chose black pieces and the default view is needed.
  Here is my code for popup window:</p>
  
  <pre><code>void OnGUI()
      {
          if (showPopUp)
          {
              GUI.Window(0, new Rect((Screen.width / 2) - 200, (Screen.height / 2) - 115
                     , 420, 180), ShowGUI, "Figures choice");
  
          }
      }
  
      void ShowGUI(int windowID)
      {
          RedirectToMenu redirect = new RedirectToMenu();
          guiStyle.fontSize = 22;
          guiStyle.normal.textColor = Color.white;
          GUI.Label(new Rect(80, 40, 200, 30), "You have chosen black pieces", guiStyle);
  
          if (GUI.Button(new Rect(180, 110, 75, 35), "OK")){
              showPopUp = false;
              redirect.LoadAsset("UpgradedRoom");
              SceneManager.LoadScene("UpgradedRoom");
          }
      }
  </code></pre>
  
  <p>I suppose I should access this script before loading the scene and disable if needed. But how can I access it outside of the scene with table, chessboard, and pieces? Or can I change the textures of game objects on another scene?</p>