Unity Support Without the SDK

I first have to make it very clear tyhat mbientlab does not support any situation that doesn't use the mbientlab SDK. If you try to ask them for help with what I am offering, they will decline to help and I agree with their doing that.

mbientlab has done an awesome job making their SDK and it is a great SDK.

I make a plugin for Unity that gives Unity developers Bluetooth Low Energy support on iOS and Android in a single plugin. It is cross platform.

I had a customer ask about using it with mbientlab devices. I said as long as it was BLE it would work.

They later asked if I had any examples because they could not figure out how to get the data coming from the mbientlab devices because the documentation doesn't give you the low level information needed to directly interact with mbientlab devices.

This is because they only support using their SDK, which is totally fine.

I tried bringing the C# SDK into Unity and ran into issues because I was trying to support iOS and Android and doing it all on a Mac, which doesn't support C#7 at all. The mbientlab SDK relies on C#7.

So I did some looking into it and was finally able to get the accelerometer working by sending the raw byte values needed.

So the example I came up with doesn't use any of the SDK. It just uses my Unity plugin for iOS and Android and the information I was able to glean from playing around with the device and sample apps with modifications I made.

If anyone is interested you can see my plugin at the Unity asset store and PM me for information about the example I created.

Here is a link to the Unity plugin:

https://www.assetstore.unity3d.com/#!/content/26661

Comments

  • edited August 2018

    If you're using Unity 2018, you don't need to import the source code into Unity. As stated in the C# SDK's readme:

    The SDK is distributed on NuGet as a platform agnostic, .NET Standard 2.0 assembly

    In other words, either retrieve the precompiled assembly from NuGet or, if you want to compile the code yourself, use the .NET Core cli to build the solution.

    It's fairly straightforward to integrate BLE functionality to our C# sdk, see the .NET Standard and Win10 plugins. The best course of action here would be to write similar glue code to bridge your BLE plugin with our SDK.

  • What you suggest might be available on Windows, but I can't find it anywhere on macOS in Unity or Visual Studio for Mac.

    If you can give some directions on that I will pursue that method instead of the path I ended up taking.

    My target is iOS and Android.

    My plugin for Unity provides the BLE layer for iOS and Android and it native code for those 2 platforms.

    It I could make this work it would be awesome. I just have not found it possible as of yet.

  • What part of my suggestion is not available on Mac?

  • edited August 2018

    Adding nuget packages to a unity project.

    Normal. Net solutions have all the nuget stuff, but unity ones that option is grey.

    Not sure if it is the same on Windows.

    Could not find any other way to add a package either.

  • Hello tpitman,
    It will be great if you can share the example you created.
    We are also using your plug-in for Android on Windows, and have some problem with Initializing the Metaboard

  • First I have to be clear that the plugin will not work in the editor on Windows or macOS. You might already know that, but in case I wanted to be clear. It will only do anything on an actual iOS or Android device.

    I created a public github project that you can take a look at there:

    https://github.com/tpitman/unity-plugin-mbientlab-metamotionr-example

  • @tpitman said:
    Adding nuget packages to a unity project.

    Normal. Net solutions have all the nuget stuff, but unity ones that option is grey.

    Not sure if it is the same on Windows.

    Could not find any other way to add a package either.

    You can manually download and extract the NuGet package, or, as I also stated, build the assembly with the .NET Core cli.

This discussion has been closed.