Skip to content

Commit

Permalink
新增打包WebGL平台文档
Browse files Browse the repository at this point in the history
  • Loading branch information
pirunxi committed Jul 19, 2023
1 parent 89069eb commit 315e328
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 0 deletions.
51 changes: 51 additions & 0 deletions docs/basic/buildwebgl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 发布WebGL平台

由于WebGL平台有较多特殊性,故特地单独文档介绍如何发布WebGL平台。本文档在 hybridclr_trial项目([github](https://github.com/focus-creative-games/hybridclr_trial) [gitee](https://gitee.com/focus-creative-games/hybridclr_trial) )上演示发布过程。

## 使用的版本

不同Unity版本及hybridclr package的发布流程都是相似的,不再赘述。

- Unity 2021.3.1f1
- com.code-philosophy.hybridclr v3.4.0

## 准备工作

:::tip
新手请至少阅读过[快速上手](../beginner/quickstart.md)文档,已经掌握Win或Android之类平台的发布流程。
:::


- 确保Unity Editor 安装了WebGL模块,如下图
- 根据 [install](install.md) 文档完成HybridCLR安装及设置
- 在HybridCLRSettings中,开启`Use Global Il2cpp` 选项。因为webgl平台只支持全局安装。


![select_il2cpp_module_webgl](/img/hybridclr/select_il2cpp_modules_webgl.jpg)

## 建立 Editor目录的libil2cpp到本地libil2cpp目录的软(硬)引用

### Win平台

不熟悉命令行的开发者请先掌握命令行的基础用法。

- 以管理员权限打开命令行窗口,这个操作不同操作系统版本不一样,请酌情处理。在Win11下为`在开始菜单上右键,选中终端管理员菜单项`
- 运行 `cd /d {editor_install_dir}/Editor/Data/il2cpp`, 切换目录到安装目录的il2cpp目录
- 运行`ren libil2cpp libil2cpp-origin` 将原始libil2cpp改名为libil2cpp-origin
- 运行 `mklink /D libil2cpp "{project}/HyridCLRData/LocalIl2CppData-{platform}/il2cpp/libil2cpp"` 建立Editor目录的libil2cpp到本地libil2cpp目录的符号引用

### MacOS或者Linux平台

- 打开命令行窗口
- 运行 `cd /d {editor_install_dir}/Editor/Data/il2cpp` 切换目录到安装目录的il2cpp目录。具体目录可能因为操作系统而有所不同,请酌情处理
- 运行`mv libil2cpp libil2cpp-origin` 将原始libil2cpp改名为libil2cpp-origin
- 运行 `ln -s "{project}/HyridCLRData/LocalIl2CppData-{platform}/il2cpp/libil2cpp" libil2cpp` 建立Editor目录的libil2cpp到本地libil2cpp目录的符号引用


## 打包

- 运行 `HybridCLR/Generate/All`
- 运行 `HybridCLR/Build/BuildAssetsAndCopyToStreamingAssets`。注意!这个菜单是`hybridclr_trial`项目添加的,并不是hybridclr package自带的命令。
-`Build Player`中运行`Build And Run`即可


49 changes: 49 additions & 0 deletions i18n/en/docusaurus-plugin-content-docs/current/basic/buildwebgl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Publish the WebGL platform

Due to the particularity of the WebGL platform, a separate document introduces how to release the WebGL platform. This document is published on the hybridclr_trial project ([github](https://focus-creative-games/hybridclr_trial) [gitee](https://gitee.com/focus-creative-games/hybridclr_trial) ) process.

## version used

The release process of different Unity versions and hybridclr package is similar and will not be repeated here.

- Unity 2021.3.1f1
- com.code-philosophy.hybridclr v3.4.0

## Preparation

:::tip
Beginners, please at least read the [Quick Start](../beginner/quickstart.md) document, and have mastered the release process of platforms such as Win or Android.
:::


- Make sure that the WebGL module is installed in Unity Editor, as shown below
- Complete HybridCLR installation and configuration according to [install](install.md) document
- In HybridCLRSettings, enable `Use Global Il2cpp` option. Because the webgl platform only supports global installation.


![select_il2cpp_module_webgl](/img/hybridclr/select_il2cpp_modules_webgl.jpg)

## Create a soft (hard) reference from libil2cpp in the Editor directory to the local libil2cpp directory

### Win platform

Developers who are not familiar with the command line should first master the basic usage of the command line.

- Open the command line window with administrator privileges. This operation is different for different operating system versions, please handle it as appropriate. Under Win11, it is `right click on the start menu and select the terminal administrator menu item`.
- Run `cd /d {editor_install_dir}/Editor/Data/il2cpp`, switch directory to the il2cpp directory of the installation directory
- Run `ren libil2cpp libil2cpp-origin` to rename the original libil2cpp to libil2cpp-origin
- Run `mklink /D libil2cpp "{project}/HyridCLRData/LocalIl2CppData-{platform}/il2cpp/libil2cpp"` to create a symbolic reference from libil2cpp in the Editor directory to the local libil2cpp directory

### MacOS or Linux platform

- Open command line window
- Run `cd /d {editor_install_dir}/Editor/Data/il2cpp` to switch directories to the il2cpp directory of the installation directory. The specific directory may vary depending on the operating system, please handle accordingly
- Run `mv libil2cpp libil2cpp-origin` to rename the original libil2cpp to libil2cpp-origin
- Run `ln -s "{project}/HyridCLRData/LocalIl2CppData-{platform}/il2cpp/libil2cpp" libil2cpp` to create a symbolic reference from libil2cpp in the Editor directory to the local libil2cpp directory


## Pack

- Run `HybridCLR/Generate/All`
- Run `HybridCLR/Build/BuildAssetsAndCopyToStreamingAssets`. Notice! This menu is added by the `hybridclr_trial` project, not a command that comes with the hybridclr package.
- Just run `Build And Run` in `Build Player`
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const sidebars = {
'basic/hotupdateassemblysetting',
'basic/runhotupdatecodes',
'basic/buildpipeline',
'basic/buildwebgl',
'basic/codestriping',
'basic/monobehaviour',
'basic/aotgeneric',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 315e328

Please sign in to comment.