My App Works Perfectly In Editor but Not On Android Build
My app works perfectly fine in the editor with no errors and it works exactly how it should. However when I build it onto my android device many aspects of the app are not functioning. Its as if 90% of my functions are not being called at all. The Update Function in my singleton control script wasn't even being called. Nothing crashes or anything it just does not work. I don't even know where to start looking as there isn't actually an error in the script.
Answer by JustinEllis · Apr 06, 2017 at 08:11 PM
Actually I managed to figure it out. It was a problem with my saving and loading system. I had edited values that were to be saved and edited but still saved and loaded to the same .dat file. I guess it just broke the whole app. I just created new ones and it works like a charm.
Answer by TailKitty · Apr 06, 2017 at 09:46 AM
Try to add some UI debug messages as we used to do in C with console =)
Just put some informative messages after your initial steps into the code and display it on your UI. In that case you will be able to better understand what the hell is going on in your android app.
Probably you just didn't initialized some of the required references and receive an null refference exception in the middle of your script without any notifications. This is usually the thing which could isolate a 90% of your code being normally executed.
One stupid thing that just came to my mind happened to me while was developing an android app which was suppose to consume a web service. It has been working as shine in my AndroidStudio but was totally dead on the real device... After struggling for a couple of days.. I just realized of a sudden that it will be a damn good idea to turn an internet on....
Why would references be lost when building the app and not in the editor itself? Would a null reference exception cause functions such as a scripts Update function not to execute? Does a singleton class conflict with anything on Android? How would I go about the visual debug messages? Do you mean just text fields set to check for something or something along the lines of Application.log$$anonymous$$essageRecieved. Thank you for your help.
Answer by hasnainnadeem7734 · Aug 19, 2020 at 02:18 PM
in my case I had some objects with missing scripts and after removing those missing scripts my issue was resolved.