I've a panel in my scene (ErrorMessage), I've been disabled it in the editor and writed this in my C# script:
if(getUsernameResponse == "Login OK") {
Application.LoadLevel("LobbyUI");
} else {
GameObject ErrorMessage = GameObject.FindGameObjectWithTag("ErrorMessage");
ErrorMessage.SetActive(true);
}
The script should enable (show) my ErrorMessage
if getUsernameResponse
have a different response of "Login OK".. but when I start the liveDemo I see this error:
NullReferenceException: Object reference not set to an instance of an object) in row:41 (ErrorMessage.SetActive(true);)
I've tried to enable the ErrorMessage
from the editor and disable with
if(getUsernameResponse == "Login OK") {
Application.LoadLevel("LobbyUI");
} else {
GameObject ErrorMessage = GameObject.FindGameObjectWithTag("ErrorMessage");
ErrorMessage.SetActive(false);
}
in my source and it works fine, how can I disable ErrorMessage
(UI.Panel) from my script?
Thanks for support.