I have a C# code where I am receiving NullReferenceException at line 15. I have some menus on my application (named "meniu1" or "meniu3"). Initially they are both activated, but depending on a variable I am trying to activate only one of them. Does anybody know why am I receiving null exception, I am new in unity.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class script1 : MonoBehaviour
{
void Start()
{
if (staticscrpt.checkvalue == true)
{
GameObject.Find("meniu1").SetActive(false);
}
else if (staticscrpt.checkvalue == false)
{
GameObject.Find("meniu3").SetActive(false);
}
staticscrpt.checkvalue = false;
}
// Update is called once per frame
void Update()
{
}
public void trig_function (){
if (staticscrpt.checkvalue == false)
{
SceneManager.LoadScene("AR");
staticscrpt.checkvalue = true;
}
}
}