Hello. I have a GameObject which I am trying to enable/disable (Using .SetActive()). However, when I use .SetActive() on the object I get the error *NullReferenceException: Object reference not set to an instance of an object*, however the object is not null. I only get this error after the scene has been restarted at least once.
Code:
public void Pause(bool boolean)
{
if (loadingScreen_Huh == null) loadingScreen_Huh = GameObject.Find("LoadingScreen");
loadingScreen_Huh.SetActive(boolean);
Time.timeScale = CoreFunctionality.BoolToInt(!boolean);
}
When I get the error this is what is shown in the inspector:
![alt text][1]
[1]: /storage/temp/204763-screenshot-2023-02-15-164611.png
↧