I am working on embedding a simple multiplayer Unity game with a Node.js server into my native Android app. Currently, I am using Unity 2022.3.40f and Android Studio (Java) with SDK 33-35.
Problem 1: Large App Size After Exporting Unity Project
When I use Unity’s “Export Project” feature and embed the Unity project into my Android Studio project, I am able to build the app successfully, and the game works fine. However, the final app size is much larger than expected—around 170MB+, which is significantly more than the Unity Android build (.apk) size of 30-35MB. The Android Studio app, which is just a blank project, is around 6MB. Despite trying different build configurations (e.g., using a single architecture), the app size remains large.
Problem 2: WebGL with WebView Issue
I also attempted using the WebGL build and embedding it via an Android Studio Java WebView. While the game runs without issue in this setup, it downloads every time it is loaded in the WebView. However, when accessed through a normal browser, it loads only once. I have tried various settings adjustments in the WebView, but nothing seems to resolve the issue.
Objective:
I aim to embed Unity games into my native platform apps, similar to companies like AAGames, which offer thousands of games within a single app. The games are downloadable with sizes ranging between 3-10MB while maintaining good quality, rather than larger sizes like 50MB+.
Request:
Could you provide guidance on how I can optimize the Unity game embedding process in my native Android app? I’m looking for solutions to reduce the app size and resolve the WebView download issue. Any advice on how to achieve a smaller, more efficient game build would be greatly appreciated.