-
Notifications
You must be signed in to change notification settings - Fork 18
Unity SCORM Integration Tutorial
armontoya edited this page Feb 21, 2012
·
12 revisions
By following the outlined steps below, you will be able to take the sample Unity project, MineSweep 3D, and easily convert it into a SCORM compliant application. Prior to beginning, it is assumed that you have installed Unity 3D 3.5 or higher with MonoDevelop, and that you have some experience with its GUI Editor, and have downloaded and unzipped the Unity SCORM Integration toolkit.
- Download and unzip the Minesweep 3D demo application into the folder where you extracted or cloned scorm4unity.
- Navigate to the folder
MineSweep 3D\Assetsand open up the scene called demoscene. - Right-click under the Project tab, and select Import Package/Custom Package. Navigate to where you have unzipped the Unity SCORM Integration Toolkit and select the package file ScormIntegrationKit.
- After importing the SCORM Integration Toolkit, you should see a new menu item marked SCORM on the main menu bar. Click on this item and select "Create Scorm Manager" from the dropdown list.
- Parent all items in the Hierarchy to the SCORM manager. This is easily done by dragging them onto the listing for ScormManager in the Hierarchy.
- Open up the GameManager.cs script file, which is a component of the GameManager object. This should open up in MonoDevelop.
- Add the following members to the
GameManagerclass:
private bool m_bInitialized;
private bool m_bCommitted;- Provide the following functions to the
GameManager:
public bool Initialized()
{
return m_bInitialized;
}
public bool Committed()
{
return m_bCommitted;
}
void Scorm_Initialize_Complete()
{
m_bInitialized = true;
}
void Scorm_Commit_Complete()
{
m_bCommitted = true;
}- In the
MenuStatescript class, modify the conditional in theOnGUIfunction to account for SCORM activation: From
if (m_bActiveState)
{
m_kRectWindow = GUI.Window(0,m_kRectWindow,ProcessWindow,"Scenario Complete");
}to
if (m_bActiveState && GameManager.Instance.Committed())
{
m_kRectWindow = GUI.Window(0,m_kRectWindow,ProcessWindow,"Scenario Complete");
}- For our simple SCORM setup, we just want to know whether the user disabled all the mines successfully or not (e.g. pass/fail). Thus, when the round is complete, we must notify the
ScormManagerof our success or failure through a simple call toSetSatisfaction, which describes whether the primary objective was satisfied or not:
public override void OnStateEntered()
{
//...snip...
if (MineDisarmHandler.Instance.GetActiveMineCount() > 0)
{
m_sScenarioState = "Player Detonated Mine";
m_kRectScenarioState = new Rect(130, 120, 140, 20);
ScormManager.SetSatisfaction(Scorm2004.successStatusType.failed); //You 'sploded yourself :-(
}
else
{
m_sScenarioState = "Player Removed All Mines";
m_kRectScenarioState = new Rect(120, 120, 160, 20);
ScormManager.SetSatisfaction(Scorm2004.successStatusType.passed); //You prevented all the 'splosions :-)
}Finally, we need to tell the ScormManager that the user completed the course and then say there's nothing more to record so it can send your data to an LMS, LRS, etc.:
ScormManager.SetCompletionStatus(Scorm2004.completionStatusType.complete); //Satisfied or not, we're still done
ScormManager.Commit(); //No going back now.