- Home /
Code works on pc but not on Android
In my Android game, I'd like to hide & show some UI objects, which is instantiated from a prefab, according to my callback functions. I disable my UI objects with something like:
GameObject[] characterUIObjects = GameObject.FindGameObjectsWithTag("PlayerUI"); foreach (GameObject obj in characterUIObjects) { obj.SetActive(false); }
and then I do the opposite in the callback function where I want to show the UI.
The weird thing is that the code works perfectly on my local machine, but it doesn't work on my Android phone (i.e. the UI objects are still active after the callback function to disable it is triggered).
I don't even know where to start debugging. Is there any nuisances I need to take into account when using FindGameObjectsWithTag or setActive on Android?
p.s. The callback functions I referred to are OnTrackingFound() and OnTrackingLost() from the Vuforia library, if that helps.
Are you getting any errors in the console? Typically the editor will tell you if a file uses classes from a different version of mono. Otherwise, perhapse Vuforia's libraries use .NET v 4.x and not 3.x. this compatibility can be changed in build settings.
Thanks for the quick reply! There isn't any error in the console. As for compatibility, can you point me to which settings should I look into? (I'm not too experienced with Android game development)
edit: I found it in player settings and changed it to .NET v4. Now it works! Thanks again.
Your answer
Follow this Question
Related Questions
Expansion/Database help 2 Answers
Android video playback 2 Answers
ARKit vs ARCore vs Vuforia vs 8th Wall 4 Answers
Android app stuck opening url 0 Answers
You may not have purchased this app (OBB Expansion Files) 1 Answer