General Android build questions

Good day,

I created a game that works well in the editor but, when I build it to Android, it behaves unexpectedly. I’ve been researching it for days but am not clear on how to redesign it to work on Android.

Basically, it’s a single-scene game that “restarts” when the player wins or loses. There are many problems with the build when it resets, primarily with the UI. The UI (UI Toolkit) completely wipes clear and the bindings don’t work anymore. I have tried reloading the scene and I’ve tried swapping to a loading scene and then back to the game scene to try to get a fresh restart but it certainly does not behave like clicking the Play button in the editor.

I would post code but I think my question is more general and I’m not sure which part of my thousands of lines of code applies to this issue. I have removed all the statics except for actions, I’ve moved as much as I can away from Start(), but nothing solves the problem. To visualize, I’ll post before and after restart screenshots. It won’t even reset when the app is relaunched. I’m very confused and would appreciate any guidance from the more knowledgeable community members.

Thank you.


I think I fixed this, though I don’t have a complete solution yet. It seems to be that I had displayed the wrong UI Panel at startup, which was messing up the whole UI in the build after reloading the scene. There are a lot of changes I need to make to the code, but the first lesson is, if the game is dependent on an certain initial set up, make sure that set up is done before build. Apologies for a silly post.

*** it didn’t actually fix the problem, just delayed it, so it has to do with the logic ***

I think this may have to do with UI Toolkit and, after hours of debugging and trying different ways to fix it, I’m really at a loss. Everything works fine in the editor but, when the scene is reloaded, the UI is wiped completely clear, like the bindings aren’t there anymore but they should be checked OnEnable.