UniWii Lag Problems

The first time I play my game in the Unity Editor it plays fine. Every time I play it after that, it gets slower and slower. The more I do with the UniWii plugin, the worse the problem is, but even with a very basic script, like the following, it happens:

using UnityEngine;
using System;
using System.Collections;
using System.Runtime.InteropServices;
 
public class WiiController : MonoBehaviour {
 
	[DllImport ("UniWii")]
	private static extern void wiimote_start();
 
	[DllImport ("UniWii")]
	private static extern void wiimote_stop();
 
	void Start ()
	{
		wiimote_start();
	}
 
	void OnApplicationQuit() {
		wiimote_stop();
	}
 
}

With the above code the main lag is after stopping the player, but it gets worse every time. After about the 4th time stopping the game from playing I end up waiting about two minutes for Unity to start responding again. After about the 6th time, Unity just stops responding at all. As soon as I remove the script referencing UniWii, everything works normally again.

If I do anything much more complex than the code above, I need to restart Unity after every play. As an example, using the basic code at http://wiki.unity3d.com/index.php?title=UniWii#How_to_Use which just says whether it can find Wiimotes works fine the first run, but on the second play the game runs about about 0.25 frames a second (yes, one frame every four seconds). The third play just crashes Unity. Upon restart, though, it works fine again for one play.

I tried using the profiler to see where the problem might be, but all it really tells me is that the script using UniWii is lagging everything, which I already know. Not sure if there are other tools I can use to try to find what specifically is causing the problem.

I am doing this as part of a school project. I am running:

Unity 3.5.0f5
Windows 7 Enterprise 64-bit
Intel Xeon CPU x5650 @ 2.67GHz 2 core processor (8 virtual cores total)
12 GB of ram
ATI FirePro V7800 (FireGL) graphics card
Rocketfish USB Bluetooth Radio (don’t remember the specific name/model)

Any help anyone can provide on this will be greatly appreciated. It is getting close to the end of the semester and, while using

For anyone still with this error, just delete Wiimote_stop() and it will work. I don’t know why this happens but worked for me and a friend working on the same project n_n