Unity Preview Server is a Unity editor extension for previewing WebGL application locally.
This extension allows you to run your WebGL application on a fixed port without building it every time.
- 2021.3 or later
- Open Package Manager window in your Unity Editor (
Main Menu > Window > Package Manager
). - Click
+
and selectAdd package from git URL...
. - Add
https://github.com/frozenbonito/UnityPreviewServer.git?path=Packages/jp.frozenbonito.preview-server
.
You can specify a version with a URL suffix like v1.0.0
.
For example, https://github.com/frozenbonito/UnityPreviewServer.git?path=Packages/jp.frozenbonito.preview-server#v1.0.0
.
See the OpenUPM package documentation.
After installing this extension, Preview Server
item will be added to the main menu.
Main Menu > Preview Server > Start
Main Menu > Preview Server > Stop
The server will automatically stop when the editor is closed or the assembly is reloaded.
Main Menu > Preview Server > Open Window...
You can edit the user settings, start and stop the server, and view the logs in the window.
Main Menu > Edit > Preferences... > Preview Server
The port number to use for the preview server. This will be used as the default value for all projects.
Default: 5000
Main Menu > Edit > Project Settings... > Preview Server
The build location for WebGL; the contents in it will be served by the preview server. This will be used as the default location for the project. Only folders with in a project can be set.
Default: Build
Main Menu > Preview Server > Open Window...
User settings are user-specific and project-specific settings.
If this item is checked, the server will serve the contents in the default build location. Otherwise, the build location in the user settings will be used.
Default: true
The build location for WebGL; the contents in it will be served by the preview server.
If Use Default Location
is checked, this is ignored.
Default: The current location for the WebGL build, or ${PROJECT_PATH}/Build
If this item is checked, the server will use the default port. Otherwise, the port in the user settings will be used.
Default: true
The port number to use for the preview server.
If Use Default Port
is checked, this is ignored.
Default: 5000
unisrv - A preview server for Unity WebGL application.