- Home /
Script works in editor, but does not work in build (Android)
I've made script that actives or deactives child gameobjects. It works fine in editor but when I build settings and put it on my phone, it doesn't, just nothing happens. There are no errors in the editor, neither on runtime nor after build is done. I have no clue why. Any possible reasons?
Script: http://pastebin.com/ewJbyRpb
PlayerPrefs.GetString("skinName")
Do you ever call SetString("skinName") in a different script? Cause I don't see it anywhere, and you have no default value set for GetString.
If that's not the problem, then you can add Debug.Logs and use logcat to pinpoint the problem.
Yes, "skinName" is called in another script. How can I use logcat?
Sometimes in a build the scripts are not executed in the same order. So Start and Awake in CharacterPresentation might be called before you are setting skinName. You can set the script execution order to make sure they execute in the correct order.
Also, rememember that GameObject.Find does not find inactive game objects.
What method should I use to find inactive gameobjects?
Create a public variable then assign it in the inspector. That is better for performance as well as opposed to using Find statements.
Answer by Arshia001 · Dec 04, 2015 at 06:31 PM
I'd bet this is due to some sort of exception. Put a log visualizer into your project, and scan the log for errors or exceptions.
Your answer
Follow this Question
Related Questions
Unity not compiling script changes 2 Answers
Weird errors pop up when I want to build my game for android 0 Answers
Android build not installing 1 Answer
Script works in Game View, but not in build 0 Answers
Unity Builds Old Version of my Scene 1 Answer