Skip to content
opera-pavelg edited this page Dec 6, 2024 · 4 revisions

This repository contains the code for the plugin which allows to register games on GX.Games and upload them. It also contains some simple game code for testing the plugin.

Installation

Open your project. Go to Window -> Package Manager. In the package manager window, press the "+" button in the top left corner. Select the option "Add package from git URL":

278681116-47c63061-dfed-45b9-91bd-321b2e24aad4

Enter the following URL in the text box:

https://github.com/opera-gaming/opera-unity-sdk.git?path=/Packages/com.opera.gx

Click Add. This is a link to the private repository. So you'll be prompted to authorize. It depends on the operational system you use (to be honest, I don't remember how I did this but I may reset the settings, try again and add the steps to the instruction if it's necessary:).

278686181-63f179cb-c2ef-446f-8123-d2e1f65cda4e

After the plugin is installed you should see it in the list of the packages.

Uploading a new game

Go to Edit -> Project Settings. Navigate to GX.Games options in the side panel:

278682292-56c841e5-09c8-44b9-86c7-4f5f47e0d913

Click the buttons "Copy the WebGL template..." and "Set Recommended Settings". The custom template is needed to suppress the most of the browser hotkeys when the play area of the web page is focused. The recommended settings change the compressing mode and set our custom template to be used for building the game.

Click the "Update" button near the label "You are not authorized" to get all the info from the cloud. It will fetch all the data from the cloud. After this step you'll be able to select the studio which will own your game:

278685085-2dca1f12-97e9-4b70-b541-37b8e5a69303

Enter the name of the game.

Press "Build && Upload". You will be notified whether the uploading was successful or failed.

Uploading an existing game to GX.Games

The process is similar. But before exporting the project you need to select it from the "Select Game" dropdown list:

278685591-28f66f06-09af-4844-9089-ba0d210af99d

Note that the most of the settings will be blocked. It is not allowed to change the game's parameters from the game editor (e.g., name, group etc). But it may be done in the browser. You can click "Edit game on Opera" to go to the game's settings page:

278685788-c859bd27-5d1a-4c2a-811d-dc88d68e3a30

Known issues

Browser hotkeys suppressing

The build template suppresses the most of the hotkeys. But there are two combinations (or maybe more) which are protected from disabling. This is Ctrl+W and Ctrl+Shift+W which close the tab and the browser correspondingly. There is a way to disable them, but this method requires to show the warning popup which is also not acceptable. So it looks like the only way to disable them is to rearrange these key combinations in the browser itself, and it should be done by the user. As for Opera GX, it is possible to rearrange the hotkeys.

These hotkeys are not invoked in the fullscreen mode so it's not a problem here.

Good to know

Unity Scripting restrictions for Web platform

  1. Unity uses so-called Ahead of Time (AOT) compilation when it builds projects for Web platform. It has some restrictions which may cause errors on running projects with certain C# features. This article describes the AOT limitations and contains recommendations to overcome them.

  2. IndexedDB is not updated immediately after saving the files using C# functions. So you need to call a function FS.syncfs to immediately synchronize IndexedDB with the virtual file system. Refer to Assets/Plugins/HandleIO.jslib, to the usage of this code and to the Emscripten doc.