title: How to set a GameObject active on one scene form a button click function on second scene that is loaded additive C#, Unity
body: <p>I'm new to coding and Unity, I'm working on a simple click style game to learn the basics of both. I've created several scenes: MainMenu, UI, 1st level and 2nd level. After pressing 'Start' in main menu i'm loading UI and 1st level additively.</p>
  
  <p>In UI layer I have a shop UI and other bits that I never want to unload. On the 1st and 2nd level i have the bits that i want to have only on those scenes. </p>
  
  <p>So, what I'm trying to do is when i purchase an item or upgrade for the 1st level i want a GameObject (sprite) to be set as active. </p>
  
  <p>What I've tried to do is to call a function in one script that is attached to GameObject in 1st level from script that is attached to a purchase button in UI scene, but from what I was able to understand from messing with it will set that game object active if it's assigned in the UI scene - so the whole thing is basicly pointless and i can do it much easier.</p>
  
  <p>Code in script attached to GameObject in 1st level scene</p>
  
  <pre><code>public class Work_Button : MonoBehaviour
  {
      public GameObject hubert12;
  
      public void Huberd()
      {
          hubert12.SetActive(true);
      }
  
  }
  </code></pre>
  
  <p>Code in script attached to GameObject in UI scene</p>
  
  <pre><code>public class Shop : MonoBehaviour
  {
      public GameObject buyHubertOnebutton;
      public GameObject test;
  
      public void UnlockHubert1()
      {
  
          if (Global_Cash.CashCount &gt;= 20)
          {
              Global_Cash.CashCount -= 20;
              buyHubertOnebutton.GetComponent&lt;UnityEngine.UI.Button&gt;().interactable = false;
              Work_Button sn = test.GetComponent&lt;Work_Button&gt;();
              sn.Huberd();           
          }
  
      }
  
  }
  </code></pre>
  
  <p>If you have any remarks anout how i've spit scenes or anything else they will be more than welcome!</p>
  
  <p>Thanks!</p>