Giter Club home page Giter Club logo

blueunity's Introduction

BlueUnity

BlueUnity is a plugin for using Bluetooth Low Energy (BLE) with Unity3d on Android.

Installation

Import UnityAndroidBluetooth.unitypackage (V1 or V2) into a Unity project. In the Scenes folder, you will find a scene "SampleScene" to test the Bluetooth plugin.

Usage

  1. Build the game using SampleScene or use the one I already built (see in 'Use this build to test').

  2. Pair your Bluetooth device with a baud rate of 9600 to your Android phone.

  3. Open the app.

  4. For V2, you can click search to display a list of paired devices in the Log Viewer.

  5. Enter the name of the Bluetooth device, and click Start.

  6. Enter data in the input field named "Enter Data to send" and click Send.

  7. To see incoming data, draw a circle in the screen with your finger to see the Log Viewer (Unity-Logs-Viewer from assets store)

See this video for a full walkthrough and how to create your own plugin.

Note: The plugin parses incoming data with inputBuffer.readLine(), which reads until it reaches a new line character ('\n').

Bluetooth Compatibility

BlueUnity was tested on HC-05, HC-06, and BM78 Bluetooth modules, also with ESP32, using the standard Bluetooth library (BluetoothSerial.h).

Adapting to Your Project

If you want to edit the plugin and adapt it to your needs, check the "Android source code" folder, which contains the code of the plugin.

Notes:

  • In the folder Assets\Plugins you will find the Android plugin and AndroidManifest (for adding Bluetooth permission), with a C# script (BluetoothService)for handling the plugin.

  • In the Assets folder, you will find another C# script (BluetoothTest) containing functions assigned to buttons to Search, Start, Stop, and Send data to Bluetooth.

Contributing or Questions

Contact: [email protected]

License

MIT

blueunity's People

Contributors

bentalebahmed avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.