How to integrate xAPI / TinCan in Unity

北城以北 提交于 2020-01-14 11:45:56

问题


I am new to xAPI/TinCan API so my question might be a bit general but I haven't found anything that can help me so far. I figured it is possible to integrate xAPI into a Unity project (a game or simulation) but how exactly do I do that? (Are there any examples/documentation I can read on xAPI & Unity?)

So am I right to understand: I need a LRS, then I can use the TinCan .NET library and integrate it in Unity and then just have some conditions in my Unity code (like finish that level..) and if they are fulfilled I create a statement like in the example here (http://rusticisoftware.github.io/TinCan.NET/) and then send it to my LRS via a normal POST? And then I can see/query this learning data in my LRS for analytics?

Plus does it work for Unity standalone, mobile and web player??


回答1:


I have little Unity experience (other than researching others' questions on this subject) but for the most part I believe you are correct. TinCan.NET should work with Unity based on what others have said, and it provides everything you need to communicate with the LRS (so no need to do your own POST, etc. instead look at the RemoteLRS class methods).

In general I would avoid querying the LRS directly for analytics reporting, instead consider it a long lived data store that should be used to populate a reporting tool. Having said that, you can certainly see the data in an LRS. You can access a free LRS at https://cloud.scorm.com (from Rustici Software maintainers of TinCan.NET) by signing up for an account.

Note you may run into a common issue with SSL certificate validation and will want to have a look at Mono https webrequest fails with "The authentication or decryption has failed" if you do.

I can't speak to the standalone, mobile, web player question, though I'd expect anything supporting .NET should work.




回答2:


An API for integrating xAPI into Unity3D has been released by the GBLxAPI open source community. This was built up from the rustici software c# library with more specific integration to the Unity game engine for collecting data for learning games. You can get access to the API from here https://gblxapi.org/community-blog-xapi-gbl/14-unity-3d-xapi-pilot-getting-started

The documentation is on the GBLxAPI GitHub site in the wiki. https://github.com/gblxapi/UnityGBLxAPI

The community also provides access to a sandbox you can test your integrations in your games to an LRS and BI tool for free as of this writing. There is also a free game demo where you can see xAPI being generated from a game.

This had been successfully integrated to a lot of games including non-learning games for collecting general game analytics using xAPI.




回答3:


Here is a simple Unity game example from HT2, a company behind Learning Locker Open Source LRS

https://github.com/HT2-Labs/unity-xapi

It is sending one xAPI statement from Start() at game initialization. I could make it working with Learning Locker and a free https://lrs.adlnet.gov/ (beware, they make your statements public here)

To make this example work:

  • git clone locally Unity example from github
  • add it to your local Unity hub
  • there will be warning about Unity old version of the example, select whatever Unity version you use and confirm version upgrade
  • open TinCanTest.cs in Visual Studio, change
string endpoint = "https://ORG_NAME.learninglocker.net/data/xAPI";
string user = "KEY";
string password = "SECRET";

to credentials of your LRS and try running the game.

Looks it uses Rustici C#/.NET TinCan library https://github.com/RusticiSoftware/TinCan.NET

which you can install from NuGet.

As of 2019 there are other free tryout LRS limited editions:
https://cloud.scorm.com/sc/guest/SignUpForm
https://www.yetanalytics.com/xapi
https://www.watershedlrs.com/product/pricing/essentials-learning-record-store

Open Source LRS
https://github.com/LearningLocker/learninglocker
https://github.com/adlnet/ADL_LRS



来源:https://stackoverflow.com/questions/40382335/how-to-integrate-xapi-tincan-in-unity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!