Getting started
To apply the Hive Axyl SDK to a Unity WebGL app, create a dedicated App ID for the WebGL app, install only the SDK modules that support WebGL, and deploy the app to a web server.
1. Create a WebGL App ID
An app whose Environment is Web uses a dedicated App ID for the WebGL app instead of sharing an App ID with another environment. Select a project in the Hive Console, and then create an App ID in Project Settings > App ID using the following values.
| Field | Value |
|---|---|
| Environment | Web |
| Store | Direct distribution |
Use the App ID you created when initializing the SDK. Service settings, statistics, and operational data for each environment are also separated by App ID.
2. Install and initialize the SDK
Follow Install the Hive Axyl SDK to install the SDK, and install the modules your app uses. Include only modules that support WebGL in a WebGL build.
The SDK package includes the WebGL browser runtime, so you do not need to add a separate host-page script for the SDK. During SDK initialization, set the WebGL App ID that you created in step 1.
3. Implement login
On WebGL, the external authentication provider's login page opens in a browser popup, and the login result is received through a message sent by the redirect page. When implementing a web login session, also apply the following settings.
- Register an HTTPS redirect URI in the external authentication provider's console.
- Set the external authentication provider's authorization URL in
OpenRequest.Url. - Set the registered redirect URI in
OpenRequest.RedirectUri. Its origin must match the origin of thepostMessagesent from the popup. - Open the login session from a user input event. If the browser blocks the popup, the login session cannot start.
- Compare the
statein the callback URL with the value stored by the app before processing the authentication result.
Hive Axyl SDK Secure Storage is unavailable on WebGL. Therefore, you cannot use automatic login that relies on the SDK to persist credentials. Implement a separate method in the app to maintain the login state.
If you do not store the GuestPlayerId, GuestToken, and deviceKey required for a guest account separately, you cannot restore the existing guest account. When implementing storage, consider that browser data may be deleted or exposed, and do not store sensitive credentials in plain text.
4. Implement payment
WebGL apps cannot use store payments. Apply PG payment, and connect payment products to an App ID whose Environment is Web and whose Store is Direct distribution.
Do not include Apple App Store, Google Play, or Steam payment Add-ons in WebGL builds. For product retrieval, purchases, receipt verification, and product delivery with PG payment, see PG payment.
5. Build and deploy for WebGL
- Select the Web platform in the Unity build profile.
- Check the WebGL Graphics API settings to ensure that WebGL 2.0 is available.
- Make sure the build does not include Add-ons that do not support WebGL.
- Build the app and deploy the output to a web server that uses HTTPS.
- At the deployment URL, verify SDK initialization, the login popup and callback, account recovery, and PG payment.
The login popup and postMessage may not work correctly on a page opened directly from a local file. Serve the build from a web server during development, and verify the login callback under the same origin and HTTPS conditions as the production service.
Pre-release checklist
- Verify that the dedicated App ID for the WebGL app has Web as its Environment and Direct distribution as its Store.
- Verify that the WebGL App ID is used to initialize the SDK.
- Verify that every SDK module and Add-on included in the app supports WebGL.
- Check popup blocking and the origin of the login redirect URI.
- Delete the browser data, and then verify login and guest account recovery.
- Verify that the WebGL app uses only PG payment.
- Verify the main features in the latest versions of Chrome, Safari, Firefox, and Edge.