Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

If I use SetActive(false) on an object, can I not use SetActive(true) on it afterwards?

$
0
0
Here's the code in question. Once I run SetActive(false) on pause it gives me a nullreferenceexception when I try to set it back to true. if (Input.GetKeyDown (KeyCode.Escape) || Input.GetKeyDown (KeyCode.P)) { if (Time.timeScale > 0) { GameObject pause = GameObject.Find ("paused"); pause.SetActive(true); Time.timeScale = 0; } else { GameObject pause = GameObject.Find ("paused"); pause.SetActive(false); Time.timeScale = 1; } }

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>