Overview
Welcome to use the Unity WebGL Mini Game Adaptation (Conversion) Solution. This solution is based on WebAssembly technology and aims to significantly reduce the cost of migrating Unity projects to the mini game platform. You can complete the adaptation without changing the engine or rewriting the core logic. Since the TCSAS mini game environment is also built based on WebAssembly and wx API, this solution can directly reuse the official adaptation path of WeChat, and the core technology stack is fully compatible.
Solution Highlights
· Preserves the original engine toolchain and technology stack.
· No need to rewrite core game logic; supports most third-party plugins.
· High fidelity guaranteed by the conversion tool and mini game runtime environment.
· mini game platform capabilities are provided to developers as a C# SDK for quick integration of platform open capabilities.
Technical Principles
Unity's BuildTarget supports the WebGL platform, and WebGL export packages run in a browser environment based on WebAssembly technology. To enable the export package to run in the mini game environment, we provide the following support:
1. Development phase: A C# SDK for platform capabilities helps developers quickly integrate platform features.
2. Export phase: A conversion and packaging tool performs Unity WebGL glue-layer adaptation, directly converting to a mini game package.
3. Runtime phase: Provides WebAssembly foundational capabilities supported by underlying interfaces.
Applicable Scenarios
This solution is suitable for game projects across various genres:
· Casual: Match-3, trivia, simulation management, tower defense, puzzle, etc.
· Action: Parkour, aerial design, light IO.
· Card & Board: Chess, card games.
· RPG: Card-based, turn-based, strategy, MMO.
Integration Process
The access process mainly includes the following three steps:
Note:
The effort time for each step is an estimate; actual time varies by project.
Feasibility Assessment
The status of important capability support is as follows. Please evaluate according to the actual project situation:
|
Unity Core Modules | Supported | Supports core modules such as Animation, Physics, AI, UI, etc. |
Render Pipeline & Interfaces | Supported | Supports standard render pipelines and URP; however, features dependent on WebGL 2.0 are in Beta testing. |
Resource Loading | Supported | Asynchronous network loading via Addressable and AssetBundle. |
Lua Scripting | Supported | Supports standard Lua and common bindings (e.g., xlua, tolua), does not support Luajit. Performance must be verified on real devices based on the actual game. |
PuerTS | Supported | Requires iOS 14.5 or above; supports JIT. |
Unity Audio | Supported | Basic Unity Audio capabilities are supported, with FMOD plugin support. Wwise is not currently supported. For long audio, it is recommended to adapt to the Mini Game audio system InnerAudio to optimize memory usage. |
Third-Party Plugins | Partially Supported | Supports most plugins, including C# plugins and non-platform-dependent C native plugins. |
Network System | Requires Adjustment | System.Net interfaces are not supported. Use UnityWebRequest for HTTP, and WebSocket communication alternatives (e.g., open-source UnityWebSocket plugin). For UDP/TCP, use WX SDK adaptation. |
Multithreading | Not Supported | Remove multithreading usage and use async/other alternative methods. |
File System | Requires Adjustment | System.File is not supported, but file storage can be implemented via the Mini Game WX SDK, with a size limit of 200MB (can be increased to 1GB upon approval if conditions are met). The adaptation plugin supports automatic caching and updating of resources. |
Tool Conversion
We provide a Unity conversion plugin to help developers automatically export their projects into mini game packages. Subsequently, you can use the TCSAS developer tools or Android/iOS real devices for preview. The following is the conversion process:
Platform Capability Access
The WeChat mini game platform provides a wide range of open capabilities, which are currently offered in the form of JavaScript APIs. To lower the barrier for developers to integrate these platform capabilities, we provide a C# SDK for platform access. Developers can call platform capabilities using familiar C# interfaces. For details, please refer to WX_SDK.