- Home /
embed unity into native android app
I know, there is a lot of stuff written about this matter. Unfortunately, none of these solutions worked for me. The closest I have been was with this tutorial: https://medium.com/@davidbeloosesky/embedded-unity-within-android-app-7061f4f473a
I managed to make this run, but problems start to show, when I try to exit my embedded unity activity or go back to previous activity. Exit almost every time causes crash from...various reasons. For example: boolean android.view.WindowInsets.isConsumed() called after mUnityPlayer.pause() throws nullpointer. or... when I replace Application.Quit() with Application.Unload(), the thread just hangs for a couple of seconds and waits to be killed by OS...and so on.
My question is...has anybody a running example with more or less current versions of unity/android?
sorry to disappoint, never tried that. but may i suggest one other approach, which might not work or be unusable because of other problems, but i think it's worth a try and wouldn't take too long?
try to export the unity project as webGL, and "embed" it via web browser control in the android app, pointed to the local webpage that results from the unity export?
no idea how you would include all of the files in android app's resources, nor if you can open something from android browser control that's in resources, nor whether it's going to open correctly, but...
to be honest, it's an issue to get help with less difficult questions than this one in here, so it's possible you will get no other reaction to this question than $$anonymous$$e, and... well... it's something, maybe better than nothing?
afterwards, i'd recommend posting to stackoverflow, if you haven't already done that.