NullReferenceException in Unity SampleApp


Hello, I am interested in visualization of EEG data in VR but have very limited developer experience.

Baby Steps: I am trying to get Unity to run the LibMuse Unity Example Application. I have followed the directions here:

When I run the application I get:

NullReferenceException: Object reference not set to an instance of an object
SampleApp.Start () (at Assets/SampleApp.cs:68)

Drilling into MonoDevelop, the offending line is this:

    Debug.Log("Libmuse version = " + muse.getLibmuseVersion());

Any ideas on how to proceed or what I am doing wrong?

Thank you!

Wish List - App (Android, iOS, Win)

Hey wise people, anyone can help @ggattis out please? Thanks!


You’ll need to run the app on an Android or iOS device.

    muse = new LibmuseBridgeIos();
    muse = new LibmuseBridgeAndroid();

This is the code in the sample app that only initializes the muse object if it detects that it’s running on an iOS/Android device.



Is there any way to develop with Unity on the PC?


I think is down right now, so I can’t check if the Windows SDK might allow that… But I do know that you can use an OSC library to receive data from the Muse when it’s connected to Muse Direct.

This is with the SharpOSC library (

void Start () {

	// Callback function for received OSC messages. 
	HandleOscPacket callback = delegate(OscPacket packet)

		var messageReceived = (OscMessage)packet;
		var addr = messageReceived.Address;

		if (addr == "Person0/elements/gamma_absolute") {
			for (int argIdx = 0; argIdx < messageReceived.Arguments.Count; argIdx++) {
				Debug.Log("This is the gamma absolute power band from sensor #" + argIdx + ": " + System.Convert.ToSingle(messageReceived.Arguments[argIdx]);


	// Create an OSC server.
	var listener = new UDPListener(7000, callback);
	Debug.Log("Listening at UDP 7000");

In Muse Direct, my connected Muse has “Person0” preprended to its OSC address. If yours is different, you’ll have to reflect that change in this code.


Thanks folks, this gives me plenty to chew on :slight_smile:

Have a great day!