I get an error like this when I build a game. when run in the editor, the game will run smoothly, but when running a game that has been created, the game will get stuck and display a message in the output log.

I have checked the object variable on the component, it’s assigned with the image and text. but why do I still get an error like this. I do not understand, I see no errors in my code. everything is in order. Here is the component : 146885-assigned.jpg

Here is some sample code :

public GameObject textWait;
public Image playerParangLogo;

// Update is called once per frame
	void Update () {
		//AmbientSound ();
		if (combatScript.swordState) {
			if (playerParangLogo != null){
				if (!playerParangLogo.enabled) {
					playerParangLogo.gameObject.SetActive (true);
				}
			}
		} else {
			if (playerParangLogo != null) {
				if (playerParangLogo.enabled) {
					playerParangLogo.gameObject.SetActive (false);
				}
			} else {
				Debug.Log ("null");
			}
		}

		if (waitingForKey)
			textWait.gameObject.SetActive (true);
		else
			textWait.gameObject.SetActive (false);
	}

to see the full code, visit this link : Full Code

does anyone know why i’m keep getting this error ??

Hi. How did you fix it? It broke my entire big project!!! I hate Unity