Android Bluetooth Multiplayer

Android Bluetooth Multiplayer
1287873--202876--logo2.png
Asset Store - Pro version
Asset Store - Basic version

Check out the iOS/tvOS/macOS version

Android Bluetooth Multiplayer allows you to add Bluetooth multiplayer to your game with just a few lines of code. It is fully compatible with Unity’s built-in networking systems. What this means is that you can easily reuse your networking code for Internet and local gaming with minimal changes, or use any of existing tutorials about Unity built-in networking.

Ever wanted to add Bluetooth multiplayer to your Android game? Then this is the one and only plugin you will ever need.

Features:

  • Fully compatible with Unity built-in multiplayer (both UNet and legacy). No need to write special networking code!
  • Documented demo examples and components to get you started immediately.
  • Powerful API to cover even advanced use cases.
  • Comprehensive documentation included.
  • Supports Unity 5.2 and newer. Pro license is not required.

Support:
For any questions about this plugin, feel free to contact me at contact at lostpolygon.com or post in this thread.
Documentation:
Android Bluetooth Multiplayer - Documentation.pdf

If you like the asset, please review/rate it on the Asset Store, I’ll greatly appreciate that :slight_smile:

You’re welcome! :stuck_out_tongue:
Wonderfull asset, I will buy it as soon as can.

Does this work on iOS?

I’m sorry, but this is Android only at the moment.

The generate manifest option does not seem to work and patch manifest is silent fail but reads succeed - you might want to include a generic AndroidManifest.xml with bluetooth permissions

Exception: Can’t generate AndroidManifest.xml!
ManifestGenerator.GenerateManifest () (at Assets/Editor/BluetoothMultiplayerAndroid/ManifestGenerator.cs:31)

That’s odd… What Unity version and operating system you are using?
I am investigating the issue, but meanwhile, you can use this AndroidManifest.xml file I’ve attached (zipped as forum doesn’t allow .xml attachments)
1294360–59621–$AndroidManifest.zip (788 Bytes)
Please let me know if you have any more problems with the plugin.

First, thank you for the awesome plugin. I had noticed an issue with the Manifest generator as well. It is failing to find the local unity copy of the manifest. I am running on OSX and just needed to edit the filepath in GetManifestOriginal(). I am having an issue initializing the bluetooth server in my project. When the server initialization is attempted it fails.

Here is a portion of the logcat

D/LostPolygonABT( 6538): Server - Starting
D/BluetoothManagerService( 2185): checkIfCallerIsForegroundUser: valid=true callingUser=0 foregroundUser=0
W/BluetoothAdapter( 6538): getBluetoothService() called with no BluetoothManagerCallback
E/BluetoothServiceJni( 4283): SOCK FLAG = 3 ***********************
D/LostPolygonABT( 6538): Server - Starting AcceptThread
D/LostPolygonABT( 6538): Unity presence: True
D/LostPolygonABT( 6538): Interop - Call event 'onBluetoothListeningStarted'
D/Unity   ( 6538): SendMessage: object BluetoothMultiplayerAndroidManager does not have receiver for function SomeInexistantMethod!

Thanks for the feedback.
Actually, as I can see from the ‘onBluetoothListeningStarted’ event being fired - it looks like server initialization is fine. Have you tried connecting to the server? UPD: What device and Android version do you have?

The “object BluetoothMultiplayerAndroidManager does not have receiver for function SomeInexistantMethod!” message is not an actual error (it means pretty much nothing), but anyway, I’ve already fixed that as well as the manifest generation on OS X - the update is on it’s way.

I had just made a rookie mistake and now everything is working fine. Thanks again.

The 1.1 update is now live on Asset Store!

Changes are:

  • device discovery API (with demo usage example);
  • fixed manifest generation on Mac OS X;
  • minor fixes.

4.2 support yet?

It works on 4.2 just as fine, no changes needed. I’ll update the docs soon.

How can I transfer raw data? If this is not possible, could you implement?

The plugin was not really intended for that… But it is possible if you have Android Pro. As soon as the Bluetooth connection between client devices and the server is established, you can send your raw data as UDP packets to the 127.0.0.1: and the data will travel over Bluetooth. Basically, you’ll have to do all your raw communications via UDP sockets. All that will require some coding work, but it’s definitely possible.

i have a question in here : Unity Asset Store - The Best Assets for Game Making

The 1.2 update is submitted to the Asset Store and is expected to be approved soon.

Changes are:

  • new GetCurrentDevice() method to get the current device information;
  • BluetoothMultiplayerAndroidManager is now instantiated automatically, no need to add prefab;
  • new SetRawPackets() method to transmit data as raw (for advanced usage).

If you want to get the update before it is approved - just send me a PM.

P.S. If you like the asset, please leave a review or rate the asset on the Asset Store, I’ll greatly appreciate that :slight_smile:

Hi there …

It is developing a Bluetooth multi-play you are developing a game of this time unity itself is very

I purchased a plug-in called [BluetoothMultiplayerAndroid].

Development is going over to some extent one problem occurred.

(Scene is divided gameplay and main menu.) And then exit game play to get even better when you try to connect to the first

The problem arises to make the (Server) in the back room.

(OnBluetoothListeningStarted ()) is, for double initialization entering it twice, signal went out of the room initialization signal (onBluetoothDisconnectedFromServer () → onBluetoothListeningCanceled ()) comes into the final those were exit of the room so as

Process is.

I think why, and know that there is a solution where signal turns on twice.

Hi,
sorry, I really wan’t to help, but I can’t understand what do you mean… Could you please explain the problem in very simple English?

Second connection does not run
(OnBluetoothListeningStarted ()) event is executed twice in a row

I’ve sent you a PM, please check your Inbox.