xAPI4Unity
Getting started
- Install xAPI4Unity package (see below).
- Go the the top bar of Unity and click
OmiLAXR > xAPI > Open Fetcher Window
- Use the tool to transform xAPI Jsons to C# by following next steps here. These steps have to be done once. Later you can use quick options to fetch the definitions.
Install by using Git url
- Go to Package Manager.
- Click on the (+) button.
- Select 'Add package from git URL'.
- Paste
https://gitlab.com/learntech-rwth/omilaxr-ecosystem/xapi-4-unity.git
and confirm.
Install by using scoped registry (recommended)
- Ensure in "Project settings" > "Package Manager" that you have the scoped registry with following settings:
- Name: npmjs
- URL: http://registry.npmjs.com
- Scope(s):
com.rwth.unity.omilaxr.xapi4unity
- Go to Package Manager.
- Click on the (+) button.
- Select 'Add package by name'.
- Place in 'Name' field:
com.rwth.unity.omilaxr.xapi4unity
.
Adding scoped registry by using manifest.json
- Alternatively, instead of adding the scoped registry inside Unity editor you can do it by using
manifest.json
file. - Go to you project root and then open
Packages/manifest.json
. - Ensure following entries in your file:
"scopedRegistries": [ { "name": "npmjs", "url": "http://registry.npmjs.com/", "scopes": [ "com.rwth.unity.omilaxr.xapi4unity" ] }]
. - By the way, you can also add here this package by adding
"com.rwth.unity.omilaxr.xapi4unity": "2.0.0"
to the dependencies (attention you can change the version).
Select your tool
Here you can decide between Unity
, Web service
and Command Line
. The web service will use the deployed xAPI registry from GitLab.
For developers we strongly recommend to choose Unity
.
In case of Command line, you have to download the CLI Tool by pressing Download Executable
.
Setup JSON Definitions Location
For transformation you need a source for the xAPI Registry definitions. You have two options: GitLab
or Local
.
In case of GitLab you will again, fetch data from published GitLab repository.
By choosing Local, you have to define the path for the clone of this repository. The selected path shall have package.json
and definitions
folder in root.
If you choose a path (e.g. ./Assets/xapi
) and click on Clone repository
, the tool will automatically create this kind of source by using git clone. To do it, git cli must be installed.
Fetcher configuration
The only option you need to do here, is to select a path where you want to place your generated C# files of the xAPI Registry. You can place it for example at ./Assets
.
JSON Watcher
In case you are using the fetcher type Unity
it will transform the JSON files to C# directly inside of Unity Editor. This can be done by using the transform button or the watcher (turned on by default and can be disabled).
Check your settings
In case of using Unity
fetcher type, everything is pre-configured by default.
Here you can review your setup. For Unity, it is strongly recommended to generated .asmdef file.
The version
field is only important if you want to flag your generated files with a specific version. Otherwise you can keep default 1.0.0
.
If you want to create an own shell or bash script for generating the files, you can click Copy to clipboard
. This way the parameters for the CLI will be copied into your clipboard.
These parameters can be passed to xAPI_Definitions_Fetcher.CLI.exe
. That's overall what this Unity editor window is doing as well.
Do the transformation
Finally, you can press on Transform JSON => C#
to generate the C# files.
If you are using fetcher type Unity
and the watcher is enabled, you can simply edit JSON files inside your Project and it will transform them automatically when you save the file.
If you are doing changes at definitions in ./Assets/xapi
you have to update the C# files.
This can be done by clicking this button again, using CLI command or clicking inside of Unity on OmiLAXR > xAPI > Quick transform JSON => C#
.