Skip to content

Unity SCORM Integration Tutorial

Parka edited this page Jun 5, 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.

  1. Download and unzip the Minesweep 3D demo application into the folder where you extracted or cloned scorm4unity.
  2. Navigate to the folder MineSweep 3D\Assets and open up the scene called demoscene.
  3. 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.
  4. 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.
  5. Select the ScormManager game object from the hierarchy, and drag the script found at ADL SCORM\Plugins\ScormManager.cs onto the Script field in the inspector.
  6. 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.
  7. Open up the GameManager.cs script file, which is a component of the GameManager object. This should open up in MonoDevelop.
  8. Add the following members to the GameManager class:
private bool m_bInitialized;
private bool m_bCommitted;
  1. 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;
}
  1. In the MenuState script class, modify the conditional in the OnGUI function to account for SCORM initialization:
if (m_bActiveState && GameManager.Instance.Initialized())
{
   m_kWinRect = GUI.Window(0,m_kWinRect,ProcessWindow,"MineSweep 3D");
}
  1. In the GameCompleteState script class, modify the conditional in the OnGUI function to account for SCORM commit hooks:
if (m_bActiveState && GameManager.Instance.Committed())
{
   m_kRectWindow = GUI.Window(0,m_kRectWindow,ProcessWindow,"Scenario Complete");
}
  1. 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, our GameCompleteState class must notify the ScormManager of our success or failure through a simple call to SetSatisfaction, which describes whether the primary objective was satisfied or not. Modify GameCompleteState.OnStateEntered by adding the new lines shown here:
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 kept from 'sploding :-)
   }

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.completed); 
   ScormManager.Commit(); //No going back now...
}
  1. From the Unity main menu, Choose File->Build Settings. In the dialog that appears, look under Platform and choose Web Player. Click the button called Player Settings.
  2. In the inspector, choose the WebPlayer Template called SCORM.
  3. In the Build Settings dialog, choose Build. Pick a location and export the WebPlayer. Close the dialog when you're done.
  4. Choose SCORM->Export SCORM Package from the main menu. Read the warning, then click ok.
  5. In the ScormPackager dialog, click the button titled Player Location on the top right. Choose the directory where you published the WebPlayer in step 9. Note: this directory should contain the WebPlayer folder.
  6. Give your course and your scene a title in the text boxes on the dialog (Note: Select the SCORM version supported by your LMS. For additional information see www.adlnet.gov).
  7. Click Publish at the bottom. Choose a filename and a location.
  8. Upload this course to your LMS. This step differs based on the LMS you are using (See ADL's SCORM Details Page for a list of certified products and SCORM Adopters). When you launch it, you will see your Unity simulation. Play through and satisfy your success criteria. Exit your simulation – you should see the LMS mark the course as passed.

That’s it! Your Unity Simulation should now report its completion and success status to the LMS. From here, you can begin tracking interactions, objectives and other SCORM data model elements. You can also access data about the student, such as name or playback preferences. You can even store data in the LMS to resume your simulation from a given state, or check other LMS features like global objectives.

For information on SCORM and SCORM conformance, see http://www.adlnet.gov/capabilities/scorm. For information on a specific version of SCORM, select the version at http://www.adlnet.gov/capabilities/scorm#tab-projects.

Clone this wiki locally