Moodle - About sending data to Unity content

Viewed 277

We are still absolute beginner in moodle. I will try to phrase our query as clearly as possible.

So, the basic requirement for our project is that, we be able to host unity games in moodle courses and track the student performances in each of the unity games. For now we have decided to go with xAPI standard. We have already setup a free LRS from scrom cloud.

My query is : How can I (moodle side developer) send the information on who is the current user that launched the unity game. So that my game developer friend can later send the statements like : A USER clicked in the BUTTON. Or, a USER ended a game with the score of 82. And things like that.

I am finding it very hard to grasp the general idea of how this works. Any help would be highly appreciated. Just pointing in the right direction would help a lot.

1 Answers

To be able to use your Unity project in Moodle you will have to add it as an activity. Moodle handle different kinds of activites (SCORM, H5P...) You can instal the following plugin which implements xAPI https://moodle.org/plugins/mod_tincanlaunch in Moodle and look its source code to get an idea. When installed, you will find the source code in the folder:

mod/tincanlaunch/

I think the general idea is:

Get the current user info in Moodle:

global $USER
$username= $USER->username;
$firstname = $USER->firstname;
$lastname = $USER->lastname;

Post those information to Unity

Get it in Unity

Then send to LRS and/or Moodle.

Maybe you can fit your Unity project to mod_tincanlaunch if it meets your needs.

Related