I am having a little trouble with DontDestroyOnLoad.
I have a gameObject which has a script attached.
The script basically does a facebook login and sets some variables like the player id, username etc.
When I switch scenes with a GameObject.find I get back the reference and extract the variables from there.
Now this works perfectly in the editor, but when I export it to Android it’s not working anymore.
When I switch the scenes, the gameObject can be found, but it seems like the variables are all null.
Is there anything wrong on Android with this?
Also here is my code:
facebookIntegration = GameObject.Find("FacebookIntegration");
if(facebookIntegration != null)
{
fbname = facebookIntegration.GetComponent<FacebookInit>().fbname;
fbid = facebookIntegration.GetComponent<FacebookInit>().fbid;
//Debug.Log("Welcome back " + fbname);
test.text = "Welcome back " + fbname;
}
else
{
test.text = "User is not logged in";
}