Show / Hide Table of Contents

Delsys API Integration with Unity

You can download the sample project from here

  1. Download the API package.

  2. For this tutorial, we'll be using the NuGet for Unity plugin. This is not required, but it simplifies obtaining the API's dependencies.

alt text

  • Install NuGet for Unity from the Asset store.

alt text

  • Install Stateless and Portable.Licensing NuGet packages.

alt text

  1. Extract each NuGet package -- the API, Stateless, and Portable.Licensing -- with a zip extractor.

alt text

  1. Copy each dll (Stateless from the lib/net45 folder, Portable.Licensing, and all of the Delsys API dlls) to the Assets folder of your Unity project.

  2. Delete the NuGet packages and NuGet config files to ensure no duplicate dependencies. Your project should now look something like this:

alt text

  1. Add code to copy the SiUSBXp.dll to the output folder if necessary.
// 
public class SomeUnityScript : MonoBehaviour
{
    // Copy the USB Driver at startup, before using any API functions.
    void Start()
    {
        CopyUSBDriver();
		// Rest of your program . . .
    }
	
	// . . . 

	// Copies the SiUSBXp.dll to the parent folder of StreamingAssets, placing it next to the Unity executable.
    public void CopyUSBDriver()
    {
        string unityAssetPath = Application.streamingAssetsPath + "/SiUSBXp.dll";
        string adjacentToExePath = Application.dataPath + "/../SiUSBXp.dll";
        if (!File.Exists(adjacentToExePath))
        {
            File.Copy(unityAssetPath, adjacentToExePath);
        }
    }
Back to top Generated by DocFX