Author Topic: Unity Compatibility  (Read 4642 times)

Offline Hawkins2k4

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Unity Compatibility
« on: April 10, 2019, 12:03:04 PM »
I have been trying to test this library out with Unity to see if it will work for me, and every time I use any of the library functions in my code the library crashes after the demo notification appears.

I am just wondering if this is a function of the demo being incompatible with Unity, or whether I have not configured my project correctly. If I purchase the framework will this persist?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3418
  • Karma: 1000
    • Wireless Communication Libraries
Re: Unity Compatibility
« Reply #1 on: April 10, 2019, 01:36:13 PM »
Hello,

Please make sure that you use .NET Standard with Unity and your project settings is .NET 4.0 compatibility.

If you still face any issue please download C++ Edition and try these demos: https://github.com/btframework/WCL-for-Unity

Please let me know if you need any help with building the demos.

Offline Hawkins2k4

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Unity Compatibility
« Reply #2 on: April 10, 2019, 02:08:40 PM »
Hi Mike,

Thanks for the fast response, I have it working now on the .NET version.

That being said, I'm looking to purchase the library, are there any differences between the .net version or the cpp version in terms of compatibility?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3418
  • Karma: 1000
    • Wireless Communication Libraries
Re: Unity Compatibility
« Reply #3 on: April 10, 2019, 02:12:43 PM »
Actually there is no difference but:

On some Mono versions it may freezes when you close the app. It is something related to Mono clean up itself. And we still can not find work around for that. Fortunately it happens not on any Unity version and not on any platform. But because that is no common issue we still can not even find any correlation and with Mono version/Windows version.

In case if you face such issue with .NET Edition we recomend to use C++ Edition with .NET wrappers (we will help you to build/prepare/modify any wrapper/migration code for Bluetooth Framework in case of C++ Edition).

Offline Hawkins2k4

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Unity Compatibility
« Reply #4 on: April 10, 2019, 02:23:38 PM »
Okay, excellent, thank you. For now I am just looking at using the framework for in editor/desktop of a mobile game to speed up the testing/deployment time. I had an issue with it hanging a few minutes ago but realized I wasn't calling wclBluetoothManager.close() in OnApplicationQuit(), if that helps at all.

Thank you for your time, I'm requesting the funds for the library today, so hopefully I'll be able to make the purchase this week.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3418
  • Karma: 1000
    • Wireless Communication Libraries
Re: Unity Compatibility
« Reply #5 on: April 10, 2019, 02:26:41 PM »
You are very welcome. Should yo uhave any question do not hesitate to ask.

Offline HenrikF

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Unity Compatibility
« Reply #6 on: October 30, 2019, 04:46:50 PM »
Hi,

Does the C++ wrapper work for Unity using .NET 2.0?

If not, do you know if it is possible to write a DLL using your framework in C++ and use that DLL to add Bluetooth functionality to my Unity project using .NET 2.0?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3418
  • Karma: 1000
    • Wireless Communication Libraries
Re: Unity Compatibility
« Reply #7 on: October 30, 2019, 04:48:21 PM »
Hi,

Yes, it does work with any .NET that is supported by Unity. Becasue the wrapper is a C++ DLL and a c# Unity script. So it is copiled (the c# script) by Unity itself.

Offline HenrikF

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Unity Compatibility
« Reply #8 on: October 30, 2019, 05:32:58 PM »
Awesome!

I try to run the sample project "GattClient" in Unity version 2017.2.1f1 and get
"The class named 'GattClient' is not derived from MonoBehaviour or ScriptableObject!"

It seems to result in the GattClient script not being possible to load. See the attached image.

Is this a known issue or am I doing something wrong?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3418
  • Karma: 1000
    • Wireless Communication Libraries
Re: Unity Compatibility
« Reply #9 on: October 30, 2019, 05:42:40 PM »
Rename the file (cs) to GattClientDemo. Not sure why it appeared sometimes.

Offline HenrikF

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Unity Compatibility
« Reply #10 on: October 30, 2019, 06:08:40 PM »
That worked, thanks!

To me, it seems like the file should be renamed to GattClientDemo for MonoBehaviour to find the main class that is named "GattClientDemo". But I'm rather new to Unity so don't take my word for it.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3418
  • Karma: 1000
    • Wireless Communication Libraries
Re: Unity Compatibility
« Reply #11 on: October 30, 2019, 06:15:33 PM »
You are correct. It worked with default name when I created the project (because of settings). But once not all settings exported to GitHub it requires that the file name should be the same as class name.

Offline HenrikF

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Unity Compatibility
« Reply #12 on: October 30, 2019, 06:21:50 PM »
Great!

 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14