dose DontDestroyOnLoad works on android?

Hi everyone.Its an app that each button opens new scene and use an gameobject to gather all variables and use them in other scenes . the app works fine on my pc but not on the Android phone after the build .other scenes are just empty ,i used WWW and yield and also DontDestroyOnLoad (this);Is it working on Android ?

[Post here.][1] Thank you for the quick response. The code functions differently when rotating a gameObject out of the cameras FOV [1]: https://answers.unity.com/questions/1439220/if-gameobject-is-in-cameras-fov-rotationally.html

1 Answer

1

I’m using it in an android application without an issue, all of the things you mentioned should be fine. I’m using WWW and Yield for downloads, as well as DontDestroyOnLoad on an object that holds user information.

thank you for your reply,i found the problem but did not solve it yet , i have used var sw = new StreamWriter ("testFile.txt"); sw.WriteLine (hs_get.text); sw.Close(); that needs to write the file , on windows it write it to the project folder ,i have to find a way on the phone , will appreciate if you have any idea .

Are you using Application.dataPath for your save location? If so, you have to make it Application.persistantDataPath for iOS and Android. This makes it save in the directory of the app, which has ample permissions.