You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plugin for using Bluetooth (teseted on HC-05, HC-06 and BM78 bluetooth modules) with Unity3d on Android
2
+
BlueUnity is a plugin for using Bluetooth with Unity3d on Android.
3
3
4
-
## How it Works
4
+
## Installation
5
5
6
-
Build the game using SampleScene or use the one i already built ( see in 'Use this build to test').
6
+
Import `UnityAndroidBluetooth.unitypackage` into a Unity project. In the Scenes folder you will find a scene "SampleScene" to test the Bluetooth plugin.
7
7
8
-
Pair your bluetooth device (tested on HC-05 and HC-06) with baud rate of 9600 to your android phone.
8
+
## Usage
9
9
10
-
Open the app.
10
+
1) Build the game using SampleScene or use the one I already built (see in 'Use this build to test').
11
11
12
-
Enter the name of the bluetooth device, click Start.
12
+
2) Pair your Bluetooth device with baud rate of 9600 to your android phone.
13
13
14
-
Enter data in the input filed named "Enter Data to send" and click send.
14
+
3) Open the app.
15
15
16
-
To see incoming data, draw a circle in the screen with your finger to see a the Log Viewer (Unity-Logs-Viewer from assets store)
16
+
4) Enter the name of the Bluetooth device, click Start.
17
17
18
-
Also see this video: https://www.youtube.com/watch?v=H3llkatHt1E (the sound is low sorry for that)
18
+
5) Enter data in the input filed named "Enter Data to send" and click send.
19
19
20
-
If you want to edit the plugin and adapt it on your needs, check the "Android Studio src" file that contains the code of the plugin, check this video by CWGTech on Creating an Android plugin for Unity3D (https://www.youtube.com/watch?v=bmNMugkOQBI&list=WL&index=2&t=171s)
20
+
6) To see incoming data, draw a circle in the screen with your finger to see a the Log Viewer (Unity-Logs-Viewer from assets store)
21
21
22
-
## Installation
22
+
See [this video](https://www.youtube.com/watch?v=H3llkatHt1E) for a walkthrough (sorry for the low volume).
23
+
24
+
> **Note:** The plugin parses incoming data with `inputBuffer.readLine()`, which reads until it reaches a new line character ('\n').
25
+
26
+
## Bluetooth Compatibility
27
+
28
+
BlueUnity was tested on HC-05, HC-06 and BM78 Bluetooth modules.
29
+
30
+
## Adapting to Your Project
31
+
32
+
If you want to edit the plugin and adapt it on your needs, check the "Android Studio src" file that contains the code of the plugin, and see [this video](https://www.youtube.com/watch?v=bmNMugkOQBI&list=WL&index=2&t=171s) by CWGTech on Creating an Android plugin for Unity3D.
23
33
24
-
BluetoothPlugin is the Android Project if you want to check the code and make changes on the Jar file.
34
+
Notes:
25
35
26
-
Add unityPackage to Unity, in folder Scenes you will find a scene "SampleScene" to test the buetooth plugin (teseted on HC-06, HC-05).
36
+
* BluetoothPlugin is the Android Project if you want to check the code and make changes on the Jar file.
27
37
28
-
In folder Assets\Plugins you will find the Android plugin named classes, AndroidManifest (for adding Bluetooth permission) and C# script for handling the plugin for you.
38
+
*In folder Assets\Plugins you will find the Android plugin named classes, AndroidManifest (for adding Bluetooth permission) and C# script for handling the plugin.
29
39
30
-
In Assets folder you will find a script (BluetoothTest) that contains functoin assigned to buttons to Start, Stop and send data to Bluetooth.
40
+
*In Assets folder you will find a script (BluetoothTest) that contains function assigned to buttons to Start, Stop and send data to Bluetooth.
31
41
32
-
For the incoming data the plugin reads till new line appears ('\n') , (inputBuffer.readLine())
33
42
<!--
34
43
## Donation Button
35
44
@@ -40,7 +49,7 @@ If this project helped you in your path, you can give me a cup of coffee :)
0 commit comments