Unity Engine
Prerequisites
To work with PortalSDK, you’ll need the following:
Unity Versions: Unity 2022 LTS, or Unity 6 LTS (Unity 6 is preferable due to updated WebGL support).
Installed WebGL Platform: Ensure that the WebGL Platform module is installed in your Unity setup.
Unity WebGL Limitations
Unity’s WebGL platform offers a powerful way to run games on the web, but there are some limitations to keep in mind:
- Performance Constraints: WebGL applications run within a browser and have different performance limits than desktop builds.
- Memory Management: WebGL has specific memory constraints and handles memory differently, which can affect large games.
- Networking: WebGL networking relies on the browser’s capabilities and may not support all network configurations.
- Texture Compression: Only certain types of texture compression are supported, which can impact visual quality and loading times.
For more detailed information, check the links below.
Links to Unity Documentation on WebGL Performance and Limitations
For in-depth information about optimizing and working within Unity’s WebGL platform, refer to these resources:
- WebGL Performance
- WebGL Texture Compression
- WebGL Embedded Resources
- WebGL Networking
- WebGL Memory Management
- WebGL Audio
How to set up Unity Game with PortalSDK
1. Set up the package from Git
- Open your Unity project.
- Access the Package Manager in Unity, and select Add package from git URL...
- Enter the repository URL https://github.com/orbit-software/com.orbit.portalsdk.git
1.1. Set up the package from a local folder (alternative way 1)
- Open repository https://github.com/orbit-software/com.orbit.portalsdk
- Download repository as zip and unarchive
Move com.orbit.portalsdk
directory into Assets/
directory of your Unity Project
1.2. Step: Set up the Unity Package directly into project (alternative way 2)
- Open repository https://github.com/orbit-software/com.orbit.portalsdk
- Download repository as zip and unarchive
Move com.orbit.portalsdk
directory into Assets/
directory of your Unity Project
2. Step: Download the WebGL Template
- Go to the repository unity-web-template and download the template files.
- Extract the contents if they are compressed.
3. Step: Copy the WebGL Template into Your Project
- In your Unity project directory, navigate to
Assets/WebGLTemplates/
. - If it doesn’t already exist, create a folder named
PortalSDK
. - Copy the downloaded PortalSDK WebGL template directory into this location.
4. Set the WebGL Template in Player Settings
- Go to Edit > Project Settings > Player in Unity.
- Under the WebGL settings, find the WebGL Template selector.
- Select PortalSDK from the selector to apply it as your template.
5. Step: Set WebGL Publishing settings
Important settings:
- Compression Format:
Brotli
- Name Files As Hashes:
true
- Target WebAssembly 2023:
false
- Use WebAssembly.Table:
false
- Enable BigInt:
false
6. Step: Build and Run for Testing
- Go to File > Build Settings in Unity.
- Select WebGL as your platform and click Switch Platform.
- Click Build and Run to test your setup.