-
Notifications
You must be signed in to change notification settings - Fork 0
Personalization Integration Template
Target Audience: software developers
The XR2Learn Unity App Personalization Integration Template demonstrates how a Unity-based XR application can communicate with the Personalization Enablers at runtime. It provides a concrete example of integrating Unity applications with the XR2Learn personalization pipeline using real-time message exchange.
This template shows how predicted user states and personalization decisions produced by the Personalization Enablers can be exchanged with a Unity application using a Publisher/Subscriber communication model. It serves as a reference implementation for developers who want to connect XR applications to the XR2Learn personalization ecosystem.
This integration relies on Redis as a message broker to enable asynchronous communication between Unity applications and the Personalization Enablers.
Personalization Enablers and the Unity application communicate by exchanging messages using a Pub/Sub protocol implemented with Redis.
This example includes:
- Code to connect to Redis in Unity
- Code to create a publisher and a subscriber in Unity
- Code defining message formats for communication with the Personalization Enablers
The Unity application includes a simple graphical interface to demonstrate this interaction.

Figure: Screenshot of the Unity application demonstrating communication with the Personalization Enablers.
Documentation for installing NuGet packages in Unity is available here.
In the Unity project:
- Go to
Window -> Package Manager -> [+] -> Add Package From Git URL - Paste the following URL:
https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity
- Open
NuGet For Unity -> Online - Search for
NRedisStack - Select the package and click
Install All Selected
The UIExample.cs script contains a working example showing how to:
- Connect to Redis as both a publisher and a subscriber
- Translate Redis messages into Unity internal variables
- Publish and receive messages exchanged with the Personalization Enablers
Running complex Unity logic directly inside Redis subscription callbacks can be difficult to debug in Unity. For example, methods such as ProcessMessageNextActivityLevel in UIExample.cs should only update primitive variables.
More complex updates should be handled inside Unity’s standard lifecycle methods (e.g. Update()), using the primitive values populated by the Redis callbacks.
To run the example application:
- Set the Redis connection string to the
ip:portof the Redis instance - Click
Connect - Select
User LevelandActivity Level - Click
Start Activityto publish a message that starts an activity - Click
Stop Activityto publish a message that stops the current activity - Observe the suggested next activity level in the dropdown on the right
- Click
Disconnectto close the Redis connection
A compiled build is provided to allow developers to test the example without building the Unity project themselves:
- Builds Link (Currently Linux x86_64 architecture)
Channel: start_activity
{
"id": "id_activity",
"user_level": "user_level",
"activity_level": "activity_level"
}Channel: stop_activity
{
"id": 0,
"timestamp": "Date.now()"
}###Unity as Subscriber
Channel: next_activity_level
{
"id": "id_previous_activity",
"next_activity_level": "next_activity_level"
}Where next_activity_level is an integer value (0, 1, or 2).
- Personalization Enablers: Training Tools
- Personalization Enablers: Inference Tools
- Personalization Tool
- Command Line Interface (CLI)
XR2Learn Personalization Enablers - Personalization Integration Template
|
Wiki - Immerse yourself in the world of XR2Learn |
- XR2Learn Platform Overview
- Tutorial: Authenticating with XR2Learn
- Marketplace
- Content Catalogue
- Community Forum
- Tutorial: Learning Graph Tool
- INTERACT Plugin
- Tutorial: Quick start with INTERACT
- Tutorial: Personalization Enablers - Getting Started
- Personalization Enablers Overview
- Tutorial: Which personalization enablers do I need?
- Personalization Enablers
* work in progress