Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Android Bluetooth Multiplayer

Discussion in 'Assets and Asset Store' started by ZimM, Jul 1, 2013.

  1. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    This plugin is compatible with Unity built-in networking. How are you going to make a Bluetooth multiplayer game for iOS with GameKit? As far as I know, Unity has no built-in support for that. Are you using some other third-party plugin to achieve that?
     
  2. Pajaroide

    Pajaroide

    Joined:
    Sep 19, 2012
    Posts:
    34
    Indeed, I would use a third-party plugin for the iOS version (prime31 or similar). I'm trying to see if it's even possible to have multiplatform bluetooth multiplayer.
     
  3. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    Well, as far as I know, all these kinds of plugins usually provide their own low-level networking API, which is not compatible with anything else. So unfortunately, I don't think there is any good way to make them compatible. However, you may use a trick: for Android version, do not use Unity built-in networking as-is, instead use RPCs only. That way you'll be able to use similar logic for iOS and Android. But this is pretty much just a hack.
     
    Pajaroide likes this.
  4. Dennin-Dalke

    Dennin-Dalke

    Joined:
    Aug 10, 2014
    Posts:
    22
    Hey Zim, I tried your dropbox apk, and the same problem:

    09-10 22:33:38.910: I/Unity(3214): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 49)
    09-10 22:33:39.815: I/Unity(3214): Event - onBluetoothConnectedToServer(): XXXX [B0:65:99:12:C3:A6], class: PhoneSmart, connectable: True
    09-10 22:33:39.815: I/Unity(3214):
    09-10 22:33:39.815: I/Unity(3214): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 49)
    09-10 22:33:46.443: E/Unity(3214): The connection request to 127.0.0.1:28000 failed. Are you sure the server can be connected to?
    09-10 22:33:46.443: E/Unity(3214):
    09-10 22:33:46.443: E/Unity(3214): (Filename: Line: 650)
    09-10 22:33:46.447: I/Unity(3214): Can't connect to the networking server
    09-10 22:33:46.447: I/Unity(3214):
    09-10 22:33:46.447: I/Unity(3214): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 49)
    09-10 22:33:46.508: I/Unity(3214): Event - onBluetoothDisconnectedFromServer(): XXXX [B0:65:99:12:C3:A6], class: PhoneSmart, connectable: True

    about the "C0:33:33:33:33:33" I changed that only to hide the real value, don't care about that, I guess that the problem can be that in my Nexus S5 I'm using the new "Android L" version of Android OS. Could this be the problem?
     
  5. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    That seems to be it. I've just installed Android L Developer Preview on my Nexus 4 and wasn't able to connect to other device as well. I've then switched bak to Android 4.4.4 and everything worked again.
    It's hard to say what is the source of the problem - Bluetooth connection seems to be working fine, but something prevents the UDP part from working. I don't think I'll be trying to fix this until Android L is out for everyone - after all, it is just a Developer Preview at the moment, so bugs should be expected.
     
  6. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    @Dennin Dalke
    Oh, I've actually tried to investigate the issue, and it seems like, that starting from Android L, all socket connections from Java now default to IPv6, which is not supported by Unity networking. I've tried to force IPv4, but nothing seems to work. Lets just hope that this is a bug in Android L that will be fixed.
    UPD: it ended up being a bug somewhere in the OS - probably in new ART runtime or in new class libraries, so IPv6 is unrelated here...
     
    Last edited: Sep 12, 2014
  7. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    Last edited: Sep 12, 2014
  8. Dennin-Dalke

    Dennin-Dalke

    Joined:
    Aug 10, 2014
    Posts:
    22
  9. Fliperamma

    Fliperamma

    Joined:
    Apr 24, 2012
    Posts:
    31
    Hi ZimM. I'm having some problems connecting my Galaxy Mini S III with a Motorola XOOM tablet ..
    "onBluetoothClientConnected(): XOOM 2 ME [40:98:4E:2F:F7:6D], class: ComputerLaptop, connectable: False"

    Any ideas why the the XOOM is marked as a "ComputerLaptop" and "Connectable = false" ? Is there any workaround for this?

    THanks!
     
  10. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    Interesting, so XOOM believes that it is a laptop... But that doesn't changes anything in terms of connection, you should still be able to connect as usual ("connectable: False" is just a hint, you can ignore that).
    UPD: I don't know why XOOM identifies itself by ComputerLaptop class, but that's what XOOM reports, I can't change this. Regarding "connectavle: False" - that's because I've never though that an Android device would report that class, so I hadn't included to the list of "probably connectable mobile devices classes". If you want, you can open BluetoothDeviceClass.cs file and add that class in the BluetoothDeviceClass.IsProbablyHandheldDataCapableDevice() method.
     
    Last edited: Sep 13, 2014
    Fliperamma likes this.
  11. Fliperamma

    Fliperamma

    Joined:
    Apr 24, 2012
    Posts:
    31
  12. jun2mar

    jun2mar

    Joined:
    Mar 8, 2014
    Posts:
    1
    Hi sir just wanna ask if this asset also allows more than 2 players connect in a game? Atleast 4 players ...
    Please reply ASAP ... I need your asset for my thesis...

    If its ok sir, kindly mail me at jun2mar@gmail.com ... for your response on my question...
     
  13. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    I've replied to you on email, but just in case someone else has this question:
    the plugin itself has no limitation in number of players. I've personally tested up to 4 players and it worked okay. But be warned, though - some old devices have a bad Bluetooth implementation, so they may not be able to serve as a host for a lot of players. However, most devices handle this just fine.
     
  14. Jun89

    Jun89

    Joined:
    Oct 13, 2014
    Posts:
    1
    Help me !
    It's urgent. I'm using unity for making a game.
    In this game, gyro sensor and accelerometer communicate by bluetooth.
    Is it possible that this plug-in can communicate with sensor's data?
    I hope you have an answer soon. please. thank you.
     
  15. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    Hi there,
    sorry for slow reply. Yes, this is possible, but not as easy, as plugin was for multiplayer between Android devices, not generic Bluetooth communication. You'll need Android Pro, because this will require usage of UDP sockets. Basically, the plugin just tunnels the Bluetooth data over UDP sockets. Then you'll have to write UDP sockets code to transmit the data.
    There was some discussion on this thread regarding this, maybe you'll want to take a look at page 2.
     
  16. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    Hi everyone,

    just wanted to announce that Android Bluetooth Multiplayer 2.0 is scheduled for release somewhere before the end of year. It'll include: bugfixes, better Unity 5 compatibility, and code standartization. Take attention about the latter one, as it'll introduce breaking changes that'll require some changes to the code. Nothing serious, though: code is now in namespace, and some methods and events were renamed, so it'd be easy to change.
    Also, Unity 3.5.7 support will be dropped as it was limiting in some aspects, and pretty much no one uses it these days. You'll still be able to use version 1.3.3 if you need it, though.
     
    Last edited: Dec 19, 2014
  17. fsfinalz

    fsfinalz

    Joined:
    Dec 11, 2014
    Posts:
    1
    I wonder whether this asset to support Android Bluetooth low energy
     
  18. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    It only supports classic Bluetooth right now. BLE support is possible in future, but at the moment, I don't own enough BLE-capable devices to implement it.
     
  19. unity007

    unity007

    Joined:
    Jul 17, 2014
    Posts:
    3
    Does that mean if I want to buy ABM 1 now that I'd have to pay again to get 2.0 when that is released in the very near future ? Or are upgrades free ?
     
  20. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    All version updates for ABM are free and will remain free.
     
  21. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    I'm happy to announce that Android Bluetooth Multiplayer 2.0 is now live on Asset Store!
    Changelog:
    • Major code refactoring and standardization.
    • Added StartListening() method.
    • Improved demos code.
    • Added basic RPC file transfer demo.
    • Fixed incorrect handling of disconnected clients that sometimes lead to crashes.
    • Implemented comparison methods for BluetoothDevice.
    • Improved compatibility with Unity 5.
    As I've mentioned, this is a major update, and pretty much whole C# part was rewritten from scratch. It is now much nicer and cleaner, but this came at a cost of breaking changes. This means that existing projects need to be updated to use the new API. The migration guide is available in the documentation ("Migrating from 1.x to 2.x" section).
    Price remains the same, and of course, the update is free for all existing users.

    Hope you'll like it. And Happy New Year everyone!

    - Serhii
     
    Last edited: Dec 31, 2014
  22. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    452
    I've used TNet for networking but it doesn't support Bluetooth. Would it be possible to use your plugin to tunnel TNet's networking over Bluetooth? A test with the demo APK worked beautifully with three Android devices, although it'd be nice to see a lot more objects in motion as a stress test.

    Also, any chance of iOS support? The Apple GameKit API's include Bluetooth peer-to-peer networking. At the moment it seems no-one's providing an iOS local networking solution other than rolling one's own.
     
  23. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    @Shifty Geezer
    TNet is not possible yet, but it is actually #1 on my list now, as I am using TNet too. TNet is a strange beast as it uses both UDP and TCP connections simultaneously, and I've never seen any other networking system doing that. Currently only UDP data is tunneled, and adding TCP support will require quite a lot of internal changes for it to work nicely. No ETA yet, but expect TNet support in the nearest feature update.

    A stress-test demo is a nice idea, I'll probably add that.

    As for the iOS support - that's doable for sure, and I'd like to do that eventually. The problem is that I don't have any iOS devices for testing (and I probably need at least 3-4 of them for that) nor I have a Mac for native iOS development, and it's hard for me to justify buying all that hardware for developing an iOS-only plugin. Maybe someday... but not in the foreseeable future for sure, unless maybe I'll find some workaround.
     
    Last edited: Dec 31, 2014
  24. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    452
    Cool. I understand the iOS thing - crazy price of entry!
     
  25. darkhus

    darkhus

    Joined:
    Nov 30, 2012
    Posts:
    17
    Hello, let me ask. I got your bluetooth multiplayer asset, it works quite ok for two devices but for three there seems to be huge lags and deleys, what I need is one device sending message and two of them recieve and do action (like eye move or blink, I use only rpc) it has to be in same time but in fact time is different. Would you give me suggestion how to speed up this so it will work instantly (as close to realtime as posibble)?
    or may be there is possibility not to use server-client achitecture (as I dont nnet that), only one device as sender and two as reciever,?
    Thanks
     
  26. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    @darkhus
    Lags and delays heavily depend on many factors, such as what devices are you using, and even what Android version do they have installed. Some devices work great without any lag, and some introduce delays. I don't think there's anything that can be done here, as this plugin certainly introduces no lag of its own. That said, how big is the lag? I've never personally saw delays more than 200-300 ms, but that was on ancient devices. Another probable reason is that you are transmitting too much data, and there's just not enough bandwidth.
    Not sure how client-server architecture could be avoided here at all, what do you mean. Bluetooth RFCOMM is similar to TCP in that there are listening devices (server), and there are devices that connect (client).
     
  27. darkhus

    darkhus

    Joined:
    Nov 30, 2012
    Posts:
    17
    thanks for reply, devices I use are new and fast with the newest android version (I tested it on 6 differet devices). Sometimes lags are more than 500ms (randolmy diferent times on different devices). Data I transmit is string no more than 32 marks, do you think is too much? Beside app you prvide on asset store for testing was working slowly as well (no real time), but I was thinking that when I will send only small string in one way to two devices from server, it will works faster. May it be that server-client as wrong configuration?
     
  28. HW_HAXOR

    HW_HAXOR

    Joined:
    Jan 15, 2015
    Posts:
    1
    My application needs low latency. What would typical latency be for this tool and what recommendations can you make for minimizing latency?
     
  29. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    500ms sounds quite extreme. How ofter do you send the data? How big is the delay in the demo app?
    There is one thing to keep in mind. The key differences between UDP (which is used in Unity networking) and Bluetooth RFCOMM is that RFCOMM guarantees data delivery, while UDP does not. Because of that, Unity networking has to implement some kind of guaranteed data delivery protocol on top of UDP. That's fine for UDP, but for Bluetooth this introduces a lot of stalls, and sometimes almost blocks the whole stack, resulting in huge delays. Basically, you can't send data too often with Unity networking working on top of RFCOMM. This isn't really a flaw in Android Bluetooth Multiplayer - it's not possible to make it differently when working on top of Unity networking.
    There are three options I can think of to decrease the delay:
    1) Decrease the rate at which the data is sent. Probably not really an option since you need it to be close to real-time.
    2) Ditch Unity networking, use AndroidBluetoothMultiplayer.SetRawPackets(true) and use UDP to manually send and receive the data. This should definitely help if you are sending data frequently, as in this case you'll ignore all the overhead of Unity networking and guaranteed data delivery (which is guaranteed anyway for Bluetooth). It's hard to predict exactly how much will this help, but it's definitely worth giving a try. I've given some hints and examples on how to do this in previous pages in this thread.
    3) Code your own custom Bluetooth data transfer routines using Android API. I doubt this could help at all, actually, but maybe as a last resort...
    There is no "typical" latency. It depends on a lot of factors: how good is the Bluetooth implementation on the device, how much data do you send, for often do you send it, for many devices are connected etc. Keep in mind that this is not a generic Bluetooth data transfer plugin, it is designed to be used in games on top of Unity networking, and works best for that scenario. You can try the demo game application (link is available in Asset Store description text) to see how it works for you.
    Basic recommendations for Unity networking: don't use reliable state synchronization, don't send RPC's way too often. That's pretty much it.
     
  30. Asaba Hayato

    Asaba Hayato

    Joined:
    Aug 14, 2014
    Posts:
    1
    Hi, Zim. Sorry to bother you and sorry if my english is not so good.

    I have a weird problem that when my client devices connect to bluetooth host device for the first time since app start, everything works fine.
    Then I disconnect by using AndroidBluetoothMultiplayer.Stop();, and try connect to the same host again, the client failed(host seems fine). and the catlogs show error as following:

    D/BluetoothMultiplayer( 7758): Interop - Call event 'JavaDevicePickedHandler'
    D/LocalBluetoothManager(13523): setting foreground activity to null
    I/Unity ( 7758): Event - DevicePicked: Xperia acro HD IS12S
    I/Unity ( 7758):
    I/Unity ( 7758): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 49)
    I/Unity ( 7758):
    I/Unity ( 7758): bd.bluetooth_connected = true;
    I/Unity ( 7758):
    I/Unity ( 7758): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 49)
    I/Unity ( 7758):
    D/BluetoothMultiplayer( 7758): Interop - Call event 'JavaDisconnectedFromServerHandler'
    D/BluetoothMultiplayer( 7758): Client - Starting

    I/Unity (22225): Event - DevicePicked: xenogears
    I/Unity (22225):
    I/Unity (22225): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 49)
    I/Unity (22225):
    I/Unity (22225): bd.bluetooth_connected = true;
    I/Unity (22225):
    I/Unity (22225): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 49)
    I/Unity (22225):
    E/BluetoothService.cpp( 388): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
    D/BluetoothMultiplayer(22225): Interop - Call event 'JavaDisconnectedFromServerHandler'
    D/BluetoothMultiplayer(22225): Client - Starting
    I/Unity (22225): Event - DisconnectedFromServer: xenogears

    Then I back to my menu, and try again, it connected fine again. catlogs show following when success:

    I/Unity ( 7758): Event - DevicePicked: Xperia acro HD IS12S
    I/Unity ( 7758):
    I/Unity ( 7758): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 49)
    I/Unity ( 7758):
    I/Unity ( 7758): bd.bluetooth_connected = true;
    I/Unity ( 7758):
    I/Unity ( 7758): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 49)
    I/Unity ( 7758):
    D/BluetoothMultiplayer( 7758): Client - Starting
    D/BluetoothMultiplayer( 7758): Client - Start ConnectThread
    V/BluetoothEventManager(13891): Received android.bluetooth.device.action.UUID
    D/BluetoothMultiplayer( 7758): Connection - Create BluetoothMediatorConnectedThread
    D/BluetoothMultiplayer( 7758): Connection - Created UDP socket
    D/BluetoothMultiplayer( 7758): UDP - Entering run() loop
    D/BluetoothMultiplayer( 7758): Connection - Start ConnectedThread
    D/BluetoothMultiplayer( 7758): Interop - Call event 'JavaConnectedToServerHandler'
    I/Unity ( 7758): Event - ConnectedToServer: Xperia acro HD IS12S

    I check my codes again and again, don't know why. I init the UUID using Awake(), and call device list using Start() (player enter a lobby scene after choosing host or client)
    hope you can help.

    Sorry for my bad english again. Please let me know if you need me provide my code further.
     
  31. darkhus

    darkhus

    Joined:
    Nov 30, 2012
    Posts:
    17
    Hey,
    do you plan to provide functionality for your plugin to work without Unity server? Just only Bluetooth fuctions which gives possibility to connect more than two devices?
    Thanks
     
  32. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    Sorry for the slow replies everyone.
    @Asaba Hayato
    It's hard to trace what's going on without having the full log. Could you please PM me with the full logcat session? Also, do you have the same behaviour with the included demo scenes? I can't actually see any errors in your log. This one line
    Code (CSharp):
    1. E/BluetoothService.cpp( 388): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
    is actually harmless and comes from deep within the Bluetooth stack - I'm having it too without any problems.

    @darkhus
    It is already possible, though it may not be as easy. You'll need Android Pro license as it requires access to UDP sockets. Basically you send the data over the UDP and it is transported over Bluetooth. See page 1 of this thread for more information.
     
  33. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    452
    The Pro license might not be necessary if you use Good Ol' Sockets from the asset store. This works with TNet and adds networking to Unity Free for about €20
     
  34. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    Yeah, I keep forgetting to mention that even though Good ol' Sockets is an asset I developed as well :)
     
  35. PerfectlyInsane

    PerfectlyInsane

    Joined:
    Aug 9, 2013
    Posts:
    74
    I recently purchased the standard version of this but I seem to have problems understanding your multiplayer demo. Once two device are connected.

    Perhaps you can provide some simple code

    How do you send data from the client to the server say in int when you click a GUI button.

    And how would the server detect that send and process it.

    Edit sorry been away from unity several months
     
  36. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    Android Bluetooth Multiplayer works on top of built-in Unity networking. Therefore, you should read Unity networking manual to know how to use it. There is nothing special going on in the demo - just regular NetworkView and RPC.
     
  37. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    452
    :D Your marketing department needs work!
     
  38. PerfectlyInsane

    PerfectlyInsane

    Joined:
    Aug 9, 2013
    Posts:
    74
    I gave it a try but i seem to be missing something. I seems i can detect the connected device via a count but any RPC calls do nothing at all. It will draw the action button on the client device once connected. But clicking the button does not change anything on the client or server.



    I currently modified the multiplayer script by removing the actor and attaching it to a GUItext. I added the following code

    Code (CSharp):
    1.     public GUIText powerGUI; //another TextGUI on the screen.
    2.            //additional functionality
    3.            if(Network.peerType == NetworkPeerType.Client)
    4.            {
    5.              if(GUI.Button(new Rect(100,125,200,100),"Perform Client Action")){
    6.                powerGUI.text="text updated..."; //local text
    7.                this.guiText.text = "Updating local text"; // local text updateed
    8.  
    9. [INDENT][INDENT]networkView.RPC("sendMyData",RPCMode.All, new object[] {5});[/INDENT][/INDENT]
    10.                networkView.RPC("sendMyData",RPCMode.All,5);
    11.                networkView.RPC("sendMyData",RPCMode.Server, 5);
    12.                networkView.RPC("DoSomething", RPCMode.AllBuffered);
    13.              }
    14.            }
    15.            if(Network.peerType == NetworkPeerType.Server)
    16.            {
    17.              GUI.Label(new Rect(100,100,100,25),"Server");
    18.              GUI.Label(new Rect(100,125,100,25),"Connections: " + Network.connections.Length);
    19.            }
    20.     [RPC]
    21.          void sendMyData(int dataSent)
    22.          {
    23.            this.guiText.text = "I received your message loud and clear: " + dataSent;
    24.            powerGUI.text="New text"; //local text
    25.            GUIText GOpower = GameObject.Find("powerGUI").guiText;
    26.            GOpower.text = "Newer text";
    27.          }
    28.         [RPC] void DoSomething(){ Debug.Log("rpc received");
    29.            powerGUI.text="New text";
    30.          }
    31.  
    32.  

    My guess its got to do with networkview id???
     
    Last edited: Feb 15, 2015
  39. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    Well, this isn't really a question about Android Bluetooth Multiplayer anymore, so it makes more sense to ask these type of questions on the corresponding Networking forum... But yes, as far as I remember, the NetworkId must match in order for RPC to be received.
    There is also a "RPC File Transfer" demo, check it out, it may help with figuring stuff out, since you're probably doing something similar.
     
  40. PerfectlyInsane

    PerfectlyInsane

    Joined:
    Aug 9, 2013
    Posts:
    74
    Sorry I figured it out.. I just need to add a network view compoennt to the object.



    One more question.. I'm looking at it in the future. With the Bluetooth connection active would it be possible to connect via wifi to say other devices via wifi.
     
  41. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    Sure, it'll work as usual.
     
  42. maki47

    maki47

    Joined:
    Feb 16, 2015
    Posts:
    29
    I've already buy your plugin. But I'll just use this for a simple game like Mancala.
     
    Last edited: Feb 18, 2015
  43. maki47

    maki47

    Joined:
    Feb 16, 2015
    Posts:
    29
    Do you have any Project files so that we can take a look how you implemented the demo? thanks

    EDIT: I found it. thanks
     
    Last edited: Feb 18, 2015
  44. Sir-Travisty

    Sir-Travisty

    Joined:
    Mar 29, 2014
    Posts:
    12
    Has anyone else experienced crashes with the new latest Unity 4.6.3 release and this plugin? It seems to occur now as soon as I do an RPC with the plugin, i.e:

    Code (csharp):
    1.  
    2. this.mNetwork.gameObject.networkView.RPC("OnBluetoothRealTimeMessageReceived", RPCMode.Others, data);
    3.  
    Its possible any NetworkView RPC would do it, but this is our only working project using networking right now and we only use it for Bluetooth.

    It last worked fine in 4.6.2f1.

    Earlier stack trace during the crash:

    Code (csharp):
    1.  
    2. D/CrashAnrDetector(  811): backtrace:
    3. D/CrashAnrDetector(  811):     #00  pc 001cedb0  /data/app-lib/com.company.game-2/libmono.so (mono_type_get_type+20)
    4. D/CrashAnrDetector(  811):     #01  pc 00216da4  /data/app-lib/com.company.game-2/libunity.so
    5. D/CrashAnrDetector(  811):     #02  pc 002ec62c  /data/app-lib/com.company.game-2/libunity.so
    6. D/CrashAnrDetector(  811):     #03  pc 002e934c  /data/app-lib/com.company.game-2/libunity.so
    7. D/CrashAnrDetector(  811):     #04  pc 002e911c  /data/app-lib/com.company.game-2/libunity.so
    8. D/CrashAnrDetector(  811):     #05  pc 004227f0  /data/app-lib/com.company.game-2/libunity.so
    9. D/CrashAnrDetector(  811):     #06  pc 0000a2a4  <unknown>
    10.  
     
    Last edited: Feb 19, 2015
  45. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    Thank you for reporting this. I'm checking all my plugins for 4.6.3 support, and it's somewhat painful... A lot of things broken. I haven't tested Android Bluetooth Multiplayer yet, but at the first glance it seems like the issue is not in the plugin, it's in the Unity's built-in networking, so it's probably best to submit a bugreport to Unity... Anyway, I'll see if I can reproduce this issue.
     
  46. Sir-Travisty

    Sir-Travisty

    Joined:
    Mar 29, 2014
    Posts:
    12
    I was suspecting that too. I'm going to build a small project today to confirm that theory. Good luck on your end for all your plugins!
     
  47. S-Ali-M

    S-Ali-M

    Joined:
    Sep 17, 2012
    Posts:
    4
    @ZimM
    Can I connent to a special port an android device and make a serial port and use
    using System.IO.Ports
    to transfer data between to device without API and use serialPorts?
     
  48. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    941
    As far as I know, Android provides no API to use a Bluetooth connection as a serial port. There isn't a lot of sense in this, as that'd mean having a separate virtual serial port for each connected device, and there could be many of them. Even if there was support in Android, current Mono has no support for System.IO.Ports on Android.
    That said, why do you need a serial port? You can setup your own Stream using the UDP method described somewhere on previous pages.
     
  49. S-Ali-M

    S-Ali-M

    Joined:
    Sep 17, 2012
    Posts:
    4
    I have a bluetooth module (HC-05) on my device that send data my game in pc and I want to port game on android device.
    In pc I use System.IO.Ports to handle transfered data from my device to PC.
    Now I want to handle this data in Android.

    thanks for your reply, I need a package seams android Microcontroller bluetooth.
     
    Last edited: Feb 24, 2015
  50. chan0110

    chan0110

    Joined:
    Jan 10, 2014
    Posts:
    1
    Hi.

    I have a little problem here.

    1. Host created and Guest Join
    2. Host stop and then Guest stopped too. Using below.
    AndroidBluetoothMultiplayer.StopDiscovery();
    AndroidBluetoothMultiplayer.Stop();
    Network.Disconnect();
    3. Host recreate and Guest try join again. (not Initialize again.)
    3-0. Guest choose device in bluetooth device list.
    3-1. DevicePicked called. (It's OK)
    3-2. Then, immediately, DisconnectedFromServer called. (why???)
    3-3. If one more trying, ClientConnected called. (Host do nothing in 3-0 ~ 3-3.)

    Why is it happened?