title: Hide and show a button in Unity (C#)
body: <p>I have a button (in UI), that I want to hide sometimes (but show again later), which means that it shouldn't show anymore and I shouldn't be able to click it. The only solution I found (that has actually managed to hide the button), is <code>SetActive()</code>.</p>
  <p>But in <code>Update()</code>, when I do <code>SetActive(false)</code> (the true/false is controlled with the variable <code>wave_happening</code> in my script), <code>Update()</code> doesn't run anymore, so I can't set it to true again.
  When I do <code>GameObject.Find(&quot;Start Button&quot;).SetActive(true)</code> in another script, it just gives me a NullReferenceException (Object reference not set to an instance of an object).</p>
  <p>This is my <code>Update()</code> function:</p>
  <pre><code>void Update() {
      wave_happening = enemy_spawner_script.wave_happening;
      Debug.Log(wave_happening);
      transform.gameObject.SetActive(wave_happening);
  }
  </code></pre>
  <p>Is there a solution to stop this problem, or another way to hide a button?</p>
  <p>I'm fairly new to Unity and C#, so I don't know very much.</p>