An open API service indexing awesome lists of open source software.

https://github.com/zzxzzk115/nw-unity

NW-Unity is a tool for auto packing your Unity WebGL output folder to a NW.js executable folder.
https://github.com/zzxzzk115/nw-unity

gameshell nwjs packer unity webgl

Last synced: 9 months ago
JSON representation

NW-Unity is a tool for auto packing your Unity WebGL output folder to a NW.js executable folder.

Awesome Lists containing this project

README

          

# NW-Unity

![LOGO](nwunity_logo.png)

![PyPI - Wheel](https://img.shields.io/pypi/wheel/nwunity) ![PyPI - Python Version](https://img.shields.io/badge/python-3.x-green) ![version](https://img.shields.io/badge/version-0.2.23-yellow)

NW-Unity is a tool for auto packing your Unity WebGL output folder to a NW.js executable folder.

----

Sample project runs on Windows:

![](./images/run_on_windows.png)

Sample project runs on GameShell:

![](./images/run_on_gameshell.JPG)

## Quick Usage

**Install by pip on Windows/Linux/MacOS:**

```powershell
pip install nwunity
```

**Install by pip on GameShell:**

```bash
sudo pip3 install nwunity
```

**Pack your game:**

```bash
# Package your Unity WebGL game(resolution is 320*240, full screen mode is on) on PC, Linux, or MacOS.
nwunity -d "/path/to/UnityWebGLDir" -n "MyGame" --width 320 --height 240 --fullscreen

# Package your Unity WebGL files on GameShell.
nwunity -d "/path/to/UnityWebGLDir" -n "MyGame" -p GameShell
```

## How to use

NW-Unity is easy to use. You can install it by pip.

### Install by pip

```bash
pip install nwunity
```

### Parameters

You can use `nwunity -h` or `nwunity --help` to get help.

| Format | Parameter Explain |
| ---------------- | ------------------------------------------------------------ |
| -d --directory | Set the root directory of your Unity WebGL files, default is current working directory. |
| -n --name | Set the name of your game, default is 'Untitled-Game'. |
| --width | Set the width of your game window, default is 1024. |
| --height | Set the height of your game window, default is 768. |
| --fullscreen | Set full screen mode on, default is off. |
| --noframe | Hide window frame title, default is show. |
| --resizable | Set resizable mode on, default is off. |
| --transparent | Set transparent mode on, default is off. |
| -p --platform | Set platform, default is normal(PC, Linux, MacOS...). Options: GameShell. |
| -i --icon | Set the icon of the game. |

### General tips

Unity WebGL uses `Brotli` to compress files by default, it has a bug: stuck at 90% when loading a game.

So, we have to change the default settings:

![](./docs/images/3_fix_loading_bug.png)

This may help you.

### GameShell tips

Make sure the OS version of your GameShell is 0.5 or newer.

You have to build and install mesa 20.1 or newer.

Switch the GPU Driver of your GameShell to Lima if it's not.

See more details [here](./docs/GameShellTips.md)

## License

The project is under the [MIT](./LICENSE) license.