This is the documentation for the Unity version of the Neuro SDK. If you are looking for the general API documentation, look here.
This SDK has been built for and tested with Unity 2022.3, but other versions will probably work as well.
If you encounter any issues while using this SDK, please open an issue in this repository.
For installing this SDK in your project, you will first need to install the following dependencies:
Afterwards, you can install the SDK in one of the following ways:
- Using the Unity Package Manager (recommended), install from the following git URL:
https://github.com/VedalAI/neuro-game-sdk.git?path=Unity/Assets
- Otherwise, if you want to make local changes to the SDK, you can install it locally by cloning or downloading this repository. Afterwards, copy the
Unity/Assets
folder into your Unity project'sPackages
folder and rename it toNeuroSdk
. Unity should detect it as a package and install the dependencies that are available in the Unity registry. You still need to install the other git dependencies manually.
If you would like to use the SDK in a modded Unity environment, install the VedalAI.NeuroSdk.Unity
NuGet package.
At the moment, due to the dependency on UniTask, only games built in Mono are supported. IL2CPP support is planned for the future.
Important
Set the NEURO_SDK_WS_URL
environment variable to the websocket URL you use for testing.
Drag the NeuroSdk
prefab into whatever scene you need to use it in. Ideally, it should be added to the first scene that is loaded, like the title screen or main menu. It will move itself into DontDestroyOnLoad
after, and multiple instances will be automatically destroyed so you don't have to worry about them. Afterwards, fill in the Game
field in the Websocket Connection
component with the game name.
Call NeuroSdkSetup.Initialize
with the name of the game that you are using. This will automatically create the necessary objects and set up the SDK. This is the only option you have if you are using the NeuroSdk in a modded environment, from a NuGet package.
Important
If using BepInEx, this function should be called in the Start
method of your BaseUnityPlugin
.
Calling it from Awake
is too early and will not work.
- Go to
Project Settings > Player
and setCompression Format
toGzip
and enableDecompression Fallback
. - Do one of the following:
- Bundle your build along with a web server that can query the
NEURO_SDK_WS_URL
environment variable via a GET request to/$env/NEURO_SDK_WS_URL
(Superbox's Web Bundler). - Specify the
WebSocketURL
URL parameter (ex.http://localhost:8080?WebSocketURL=ws://localhost:8000
)
- Bundle your build along with a web server that can query the
Note
If you are building in WebGL and want to use the Neuro SDK, your application cannot be run on itch.io or other websites which embed it, instead it needs to be manually run on localhost.
As such, it is technically not a "browser game" anymore, so you might as well build it normally.
Please refer to the USAGE.md
file for information on how to use the SDK.