Search Unity

Android Bluetooth Multiplayer

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

  1. Saeed_Sryhini

    Saeed_Sryhini

    Joined:
    Apr 3, 2015
    Posts:
    1
    thank you for this great asset, I just noticed it doesn't have any send functions, does this mean that I have to use the unity networking send functions?
     
  2. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Hi there, yes, Android Bluetooth multiplayer just tunnels the data, actual data transmission/receival must be done via Unity networking. RPCs work well for this.
     
  3. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    That's strange, it shouldn't be that way. I'll investigate the issue and try to reproduce it.
     
  4. PerfectlyInsane

    PerfectlyInsane

    Joined:
    Aug 9, 2013
    Posts:
    74
    So any update on Sir Travisty issue.. I'm still running 4.62.. and looking to update to 4.63
     
  5. dshewmaker

    dshewmaker

    Joined:
    Oct 31, 2013
    Posts:
    18
    Hello,

    Can this be used between an Android tablet and Windows machine? Currently use unity networking to send commands from a tablet to a windows workstation and would like to use Bluetooth instead of Wi-Fi. It looks like we would just need this on the tablet and it would send the unity networking command over Bluetooth. Looks like we would then need to pass from Bluetooth back into unity networking on the windows machine?

    Dennis
     
  6. PerfectlyInsane

    PerfectlyInsane

    Joined:
    Aug 9, 2013
    Posts:
    74
    Hi RPC calls seem to be working fine for me having upgraded my unity from 4.62 to 4.64.

    I'm using jdk1.7.0_75 and android 5.01 (I'm assuming) build for 3.0 minimum.

    Tested on 4.4.2 devices Nexus 7 2013, and Moto G1
     
  7. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    can i use this plugin for racing game? is enough smooth? demo apk not work smoothly on my cheap android 4 tablet is this problem from my cheap device?
     
  8. Varcarain

    Varcarain

    Joined:
    May 7, 2015
    Posts:
    1
    Hey.. I have been working these past months with getting this plugin to work along side google cardboard but no matter how much I try I can't get them both running at the same time. The closest I have been is to merge the two AndroidManifest.xml files with each other, removing the intent filter from the Bluetooth plugin activity, at which point I was able to connect two phones with each other - with cardboard running - but unable to send data from one to the other. My android skills are pretty limited as I have only been working with it for a short amount of time so I might be missing something obvious, but any help towards getting these two plugins to work simultaneously would be greatly appreciated.

    Cardboard sdk: https://developers.google.com/cardboard/unity/

    Just for further explanation: What I am trying to do is to send accelerometer data from one phone (the client, not running cardboard) to the other (the server, running cardboard). Currently I have an app that can send data from one phone to the other which works fine, I just can't get that same piece of code to run when I try to add the Cardboard into the equation.
     
  9. Danibal

    Danibal

    Joined:
    May 26, 2015
    Posts:
    1
    Hi i have doubt your plugin can comunicate with cellphone´bluetooth ?
     
  10. PerfectlyInsane

    PerfectlyInsane

    Joined:
    Aug 9, 2013
    Posts:
    74
    I think its between two Android devices only. And not like PC and android, and NOT ios and android
     
    Rahulr3636 likes this.
  11. Rahulr3636

    Rahulr3636

    Joined:
    Jun 24, 2015
    Posts:
    1
    hi your asset is amazing
    i figured out the Bluetooth connectivity but i am not sure how to transmit data(like the x,y coordinates) to the other device
    any help would appreciated .
     
  12. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Android Bluetooth Multiplayer works with Unity built-in networking. As such, you are required to know it in order to use this plugin.
    Take a look at these links for some guides tutorials on that topic:
    http://docs.unity3d.com/Manual/NetworkReferenceGuide.html
    http://www.paladinstudios.com/2013/07/10/how-to-create-an-online-multiplayer-game-with-unity/
    http://answers.unity3d.com/questions/47544/multiplayer-tutorials.html
    http://www.youtube.com/playlist?feature=edit_ok&list=PLnFrutcRi6Ig2XaP3pXKwZhprtm8xpdvz
     
  13. sstephane

    sstephane

    Joined:
    Nov 5, 2009
    Posts:
    30
    Thank you Serhii for this great asset. It works great with the Built-in Unity 5.1 networking legacy system. I was wondering if it could work with the new networking introduced with Unity 5.1? From my first test it did not but I am not sure why. Is there some limitation?
     
  14. KokiPenta

    KokiPenta

    Joined:
    Jul 15, 2015
    Posts:
    2
    Hi! I do the same question. You will update the asset???
     
  15. jesliwang

    jesliwang

    Joined:
    Apr 1, 2013
    Posts:
    4
    Hi! When I connected both Wifi and Bluetooth, It seems wifi was prefer!!!. Is there a way to set use Bluetooth ?
     
  16. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    @dlerozeun, @KokiPenta
    Yes, I'm looking into updating the asset to support new Unity Multiplayer, but there is no ETA yet.
     
  17. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    What do you mean under "prefer"? You have to use the 127.0.0.1 IP address to connect over Bluetooth. Could you elaborate?
     
  18. boromir111

    boromir111

    Joined:
    Oct 31, 2015
    Posts:
    2
    How many players connection support this asset? Support iOS and Android connection?
     
  19. kabbali

    kabbali

    Joined:
    Nov 15, 2015
    Posts:
    1
    Hello, i can integrate this plugin, i always get -2 in the BTconnector.connet(), but i dont know why because my device have bluetooth is already paired.

    i only need to send a char via bluetooth since unity to arduino HC-06 and other one since arduino from unity.
     
  20. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    902
    Any news on TNet integration?
     
  21. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    It depends. Plugin itself has no set restrictions. The possible amount of players depends of a lot of factors: Bluetooth hardware, Bluetooth drivers, Android version. I can say for sure that on a relatively modern device you can count on 4 players or more. Keep in mind, though, that overall multiplayer performance will somewhat degrade when more players are connected.
    As we've already figured with you on email, you've mixed it up with some other asset. Android Bluetooth Multiplayer has no BTconnector class.
    Not really :/ As it turned out, I'll have to pretty much rewrite Android Bluetooth Multiplayer from scratch to support TNet, and the demand is not that big... I still plan to do that someday, but there's no ETA. Instead, I'll soon add better support for new Unity Multiplayer (aka UNet), since it's going to replace the old RakNet-based networking.
     
  22. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    I just purchased your Android Bluetooth Multiplayer asset.
    Upon import, I'm seeing many warnings:

    `UnityEngine.RPC' is obsolete: `NetworkView RPC functions are deprecated. Refer to the new Multiplayer Networking system.'

    The Asset Store information proclaims: " Fully compatible with Unity built-in networking."
    I was unaware that this referred to the legacy RakNet only. I guess I should have asked some questions first.

    I've since read here that you plan to better support UNet. Any ETA on that endeavor?

    Thanks.
     
  23. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    ETA - somewhere next month. Can't say more precisely, sorry.
    However, Android Bluetooth Multiplayer actually does works with the new UNet system even in the current version, and some people are already using it that way. The only thing missing are examples, but it should be straightforward after looking at the RakNet examples.
    Feel free to ask if you'll encounter any difficulties.
     
  24. mat33n

    mat33n

    Joined:
    Jul 14, 2014
    Posts:
    1
    Hi, I am fairly new to multiplayer games but I have tried the plugin, it is easy to establish the connection but I am unable to send data at all. RPC are obsolete so can you please provide the examples of the plugin working with new UNET.
     
  25. alone1992

    alone1992

    Joined:
    Oct 23, 2012
    Posts:
    156
    Can I use it for more than 2 players?
     
  26. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Yes, I've personally tested 4players and it worked well. Though the connection quality degrades somewhat when more and more people are connected, but it's usually fine, unless the player devices are very old.
     
    alone1992 likes this.
  27. W_A_LL

    W_A_LL

    Joined:
    Feb 12, 2015
    Posts:
    2
    Dear ZimM,
    I'm very interested in this plugin. I need to develop an application where the PC is the server and an Android phone connects as a client. If they connect, I can use networking gameobjects to comunicate between them.

    I was thinking in developping the Pc server part using
    Network.InitializeServer(1, connectPort, false);
    Do you think that using the same port in the Android client they are going to connect?

    What shoud I do?
    Thanks in advance.
     
  28. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    This plugin does not supports Bluetooth communications on the PC, but you don't need Bluetooth to do that, a regular WiFi connection will work.
     
  29. avinaom

    avinaom

    Joined:
    Apr 2, 2014
    Posts:
    4
    hey ZimM,
    I work on a project and before i buy the product i wanted to try your demo.
    so i downloaded: Android Bluetooth Multiplayer v1.21 to test the demo.
    I import the package and connect my galaxy s5 mini and asus tablet (Asus MeMO PAD ME173X)

    The code worked for me a number of times, but yesterday it stopped.
    I deleted everything and re-imported the package but still no connection.
    Network.peer stays disconnected...
    what can I do to make the connection work?

    as you can see in the image the preferb is instantiated but there is no connection, to the side is the code that should work.
    http://postimg.org/image/3ztuf8ie9/

    edit: just finished factory reset my tablet and everything went back to normal! tnx!
     
    Last edited: Feb 27, 2016
  30. avinaom

    avinaom

    Joined:
    Apr 2, 2014
    Posts:
    4
    Hey ZimM

    In your Demo, if I want to use the prefab of the third Client, how can i know which connection is the third?
    using Id for each client seems a bit complicated so I tried using Network.connections.Lenght, but on the third connection it's value remained 1 and not 2.. or 3.. is there a way to find the number of devices connected?

    thanks. Avinoam
     
  31. Joyrider

    Joyrider

    Joined:
    Aug 31, 2012
    Posts:
    27
    Hey ZimM,

    This is exactly what I needed, so a big thanks for developing this and preparing a file transfer demo ;)

    Just one thing I'm wondering, as I'll be using this in conjunction with a VR app on a GearVR, I cannot be using any native dialogs (unlike a cardboard app, I cannot use native dialogs once the app is launched)

    Is it at all possible to not use any native dialogs?
    For some it shouldn't be an issue I think, but I wasn't able to find a workaround in your methods for requesting device discoverability without any native dialogs...

    Thanks for your help! ;)
     
    Last edited: Mar 15, 2016
  32. Anthony_GR

    Anthony_GR

    Joined:
    Jun 11, 2014
    Posts:
    1
    First of all, sorry for my bad English... I tried to synchronize the color of the two "spheres" launching the "BluetoothMultiplayerAndroidDemo" scene...the code is:
    Code (CSharp):
    1. if (GetComponent<NetworkView>().isMine) {
    2. if (BluetoothMultiplayerAndroidDemoGui.pressed)
    3.                 GetComponent<Material>().color = Color.blue;}
    4. .....
    the variable pressed was declared in another script and it becames true when a button is pressed.
    The color of the material change only on the device in which the button is pressed... in the second device the color of the sphere doesn't change...
    can anyone help me?
     
  33. VRotein

    VRotein

    Joined:
    May 16, 2016
    Posts:
    4
    Can I check to connect multiple devices at the same time ?

    A Device Try Connect
    A Device Result
    B Device Try Connect
    B Device Result

    XXXXXXXXXX

    A Device Try Connect
    B Device Try Connect
    A Device Result
    B Device Result

    OOOOOOOOO
     
  34. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Would buy if it could work for iOS :p

    Doesn't people usually release games on both platform? would be weird if multiplayer aren't supported for the iOS counterpart.
     
  35. VRotein

    VRotein

    Joined:
    May 16, 2016
    Posts:
    4
    AndroidBluetoothMultiplayer.GetCurrentDevice() function does not work properly.

    * Android Version 6.0.1
    return Address :02:00:00:00:00:00
     
  36. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    902
    You could provide BT only network on Android and other solutions on iOS (and both devices as appropriate). Can't blame developer if iOS won't support BT networking. Apple are very good at limiting what you're allowed to do with their hardware.
     
  37. D4us

    D4us

    Joined:
    Jan 28, 2016
    Posts:
    1
    hi there, i am new to unity networking, but your plugin works really well that i am able to create my own multi player android game ! Thanks,

    but i want to request you that please make a plugin that can connect android devices via wifi . is that even possible ?
    and if there is a thing like this already exist please guide me to it ,

    Thanks again !
     
  38. Mini-Pao

    Mini-Pao

    Joined:
    Mar 30, 2016
    Posts:
    3
    Hi ZimM,
    Im working on multiplayer game. Can i still use this asset on Unity 5.1?

    Thanks!
     
  39. Mini-Pao

    Mini-Pao

    Joined:
    Mar 30, 2016
    Posts:
    3
    Can someone post a Sample of using this on the new UNet? I just bought this asset, is the support for this asset still active?
     
  40. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Sorry for no replies lately, everyone. This plugin is definitely not abandoned, in fact, version 2.1 was in development for a long time, it will be greatly modernized and will include proper demos for new UNet networking system.

    Also, I'm happy to announce than an iOS version is in development, and will probably be released in a month or two. Yes, after all those years :D It's a totally new plugin, in fact, and it will be different to Android version, but the general idea will remain the same. It will only support iOS-to-iOS multiplayer, iOS-to-Android is still not really possible in practice.

    Now on to replies...

    So, you've directly said that you've pirated the plugin, and ask for support on the official forum thread? That's not how it works :)
    Device discoverability can only be enabled via native dialogs. This is a security restriction of Android, nothing I can really do about. This makes sense, though - imagine any random app being able to enable discoverability and transfer data to other devices without you even knowing that... The workaround for GearVR is, I guess, to pair with other devices beforehand.
    This question is not related to Android Bluetooth Multiplayer, it's about Unity's networking system, so you might ask it in the appropriate forum. But. in short, you are just changing the color on your local device. How could other devices in session know about that too?.. Instead, you should send an RPC that notifies other players about the change of color.
    Not really. Android Bluetooth Multiplayer works under assumption that whatever device you are trying to connect to, can actually be connected to. Might I ask, what case are you trying to solve there?
    See the announcement above :) An iOS version will finally happen!
    There is no need for a plugin. Unity networking supports Internet and WiFi connectivity out of the box.
    Yes, you can use it with Unity 5.1. An updated version with included demos for UNet will come out soon. Support is so much alive :)
     
  41. check_marc

    check_marc

    Joined:
    Jan 26, 2013
    Posts:
    55
    Mini-Pao,

    Here's a stripped-down, incomplete version of my classes to demonstrate how I integrated this with UNet. You need to point UNet to whatever port you give to your Bluetooth Server, and only give it a local IP address when acting as a client. Bascially instead of UNet looking externally to a host IP, AndroidBluetoothMultiplayer gets messages from the host and delivers them to a local port. I hope that makes sense, I'm new to networking.

    Code (CSharp):
    1. using System;
    2.     using UnityEngine;
    3.     using UnityEngine.UI;
    4.     using UnityEngine.Networking;
    5.     using UnityEngine.Networking.Match;
    6.     using LostPolygon.AndroidBluetoothMultiplayer;
    7.  
    8.  
    9.     public class BluetoothLobbyManager : NetworkLobbyManager
    10.     {
    11.         private const string kLocalIp = "127.0.0.1";
    12.         private const int kPort = 28000;
    13.  
    14.         void Start()
    15.         {
    16.             AndroidBluetoothMultiplayer.ListeningStarted += OnBluetoothListeningStarted;
    17.             AndroidBluetoothMultiplayer.ConnectedToServer += OnBluetoothConnectedToServer;
    18.         }
    19.  
    20.         public void StartBluetoothHost(){
    21.             if (AndroidBluetoothMultiplayer.GetIsBluetoothEnabled ()) {
    22.                 AndroidBluetoothMultiplayer.RequestEnableDiscoverability (120);
    23.                 AndroidBluetoothMultiplayer.StartServer (kPort);
    24.             }
    25.         }
    26.  
    27.         private void OnBluetoothListeningStarted() {
    28.             networkPort = kPort;
    29.             StartHost ();
    30.         }
    31.        
    32.         private void OnBluetoothConnectedToServer(BluetoothDevice device) {
    33.             networkAddress = kLocalIp;
    34.             networkPort = kPort;
    35.             StartClient ();
    36.         }
    37. }
    38.  
     
  42. FlyingKiwi

    FlyingKiwi

    Joined:
    Jun 14, 2013
    Posts:
    12
    Hi ZimM,

    I'm working on a project where i want to use a mobile (android) device as a controller for a windows desktop application using bluetooth. After doing some research about this, i stubled upon your plugin. (Both the android-app aswell as the desktop application will be build with Unity3D)

    You write that only Android to Android communication is supported, so this might be a stupid question :) But can i use this to talk from the android device to the desktop application?
     
  43. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    Questions, how accessible is this plugin?

    1. Do i have to pair the devices first?
    2. Can i create networking experiences between more than 2 devices, like a 2vs2 brawl or do i have to pair each device with each other per prompt or else before this could even work in principle?
    3. I guess on install you will get the android-inherent bluetooth access prompt (android-manifest)
    4. when playing you get that android-inherent of bluetooth-enable prompt when trying to use something while bluetooth is off

    Why? I am prototyping a kind of 2-6 player brawl game right now, i wanted to know if it is possible to create such a thing with bluetooth-networking only. I imagine meeting 3 of your friends in the park and having a brawl-battle on the spot (actually i never leave my basement).
     
  44. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Kind of. You can use this plugin for the Android side of the communication, but for the desktop, you'll have to figure out Bluetooth communication on your own. Desktop is not supported by Android Bluetooth Multiplayer.
    1. Devices must be paired before in order for Bluetooth connection to succeed. It's just the way Bluetooth works. That said, you don't have to pair devices manually - the pairing will be initiated automatically if an attempt to connect to a unpaired device is made.
    2. Absolutely. Client devices are only connecting to the single server device, they don't have to be paired each with each other, only with the server.
    3. Do you mean the permission request dialog on Android 6.0 when starting the app? Both BLUETOOTH and BLUETOOTH_ADMIN are "normal" permission, they don't have to be requested explicitly. However, since Android 6.0, discovering nearby Bluetooth devices requires a ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION. So you won't get the Bluetooth permission request, but you'll get Location permission request.
    4. Not sure what do you mean. Of course, Bluetooth needs to be enabled. If you are trying to start the server, or connect to the server when Bluetooth is off, you can show the native Bluetooth enable dialog.

    It should be totally possible to make a game like that using Bluetooth only. But really, thanks to Android Bluetooth Multiplayer, there is no real difference between WiFi and Bluetooth in terms of networking code.
     
    Marrt likes this.
  45. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Good news everyone!

    The time has come. Android Bluetooth Multiplayer has been updated to version 2.1.0, featuring long-awaited official UNet support.

    Changelog:
    • Official UNet support.
    • New UNet-based multiplayer demo.
    • Added an example of implementing custom device discovery UI.
    • Improved Android 6.0 support.
    • Rewritten manifest generator/patcher, much more reliable now.
    • Removed Vuforia 3.5 support. With Vuforia 5 there is no need for a special Activity anymore.
    • Dropped support for Unity 5.1 and older. Unity 5.2 or newer is now a requirement.
    • Code cleanup and refactor.
    • Minor fixes and improvements.
     
    Marrt likes this.
  46. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    Nice, i bought this package (basic) two weeks ago and i got it to work for me.

    EDIT: i just needed to Update my Android SDK -.- upload_2016-10-17_18-22-42.png
    Plugins/Android/AndroidManifest.xml
    You need to add a line to the manifest or you will get en error that says Unity cannot merge Manifests because it needs version 24 while it is 23. There you go:
    Code (csharp):
    1. <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="24"/>
    otherwise you get this:
    CommandInvokationFailure: Unable to merge android manifests. See the Console for more details.
    C:/Program Files/Java/jdk1.7.0_80\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="M:/AndroidSDK\tools" -Dfile.encoding=UTF8 -jar "S:\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

    stderr[

    ]
    stdout[
    Warning: [Temp\StagingArea\AndroidManifest-main.xml:15, S:\UnityBuilds\TheTrainingShooter\Temp\StagingArea\android-libraries\AndroidBluetoothMultiplayer\AndroidManifest.xml:3] Main manifest has <uses-sdk android:targetSdkVersion='23'> but library uses targetSdkVersion='24'
    ]
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.HostView:OnGUI()

    Maybe you should update you ManifestGenerator for that
     
    Last edited: Oct 17, 2016
  47. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    I can't reproduce this issue. Just created a new Unity project, imported the plugin into it, and it went without any errors. What Unity version do you use? Perhaps your Android SDK is out of date?
     
    Marrt likes this.
  48. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    Unity should be up to date but my SDK... well, that might be the case, can't really remind the last time i updated the Android SDK. I will check at home tonight. EDIT: Yep, solved it

    Anyway, i just want to say thank you for creating this asset! Previously local ad-hoc multiplayer seemed like something unachievable to me, right up there on a shrouded mountain-top.

    But i am puzzled why so few games are out there that actually use Bluetooth-multiplayer (i can only think of "Bombsquad" and "Dual") since it is such a great feature (recreates that LAN-Party feeling).
    Seems like most of the games on those lists only have a comment requesting bluetooth-multiplayer
    http://appcrawlr.com/android-apps/best-apps-bluetooth-multiplayer
    Other lists are similar and mostly feature games that are local-multiplayer on the same device (two players tap onto the same screen, which sucks for anything but tablets)

    Maybe it is about money:
    - I mean, where is the market for a game that can be played over Bluetooth locally. If you make it a paid-feature most people would never buy it (especially for the thrifty android users, really, just yesterday i heard someone announce that he is proud of playing clash of clans for 9 months without ever spending a single euro on it)

    - And if you make it free you won't get much ad-revenue since no Internet is required.

    The only way "paid" might work is if only creating a server is a paid feature. So you can join with the free version, but at least someone has to have a paid-version. But i don't like that idea either. Eye Candy maybe? Special customization for pro users? Anyway, i guess that these kind of thoughts turn developers off of Bluetooth-multiplayer
     
    Last edited: Oct 20, 2016
  49. Mini-Pao

    Mini-Pao

    Joined:
    Mar 30, 2016
    Posts:
    3
    Hi Zimm,
    I was trying to build the BluetoothMultiplayerDemo on UNet Folder but this error occurs

    Code (CSharp):
    1. Failed to compile resources with the following parameters:
    2. -bootclasspath "C:/Users/daniel/Desktop/AndroidSDK/android-sdk-windows\platforms\android-24\android.jar" -d "C:\Users\daniel\Desktop\For Testing New S***\Temp\StagingArea\bin\classes" -source 1.6 -target 1.6 -encoding UTF-8 "com\lostpolygon\unity\bluetoothmediator\R.java" "com\SecretCompany\SwipeTest\R.java"
    3. warning: C:\Users\daniel\Desktop\AndroidSDK\android-sdk-windows\platforms\android-24\android.jar(java/lang/Object.class): major version 52 is newer than 51, the highest major version supported by this compiler.
    4.   It is recommended that the compiler be upgraded.
    5. warning: C:\Users\daniel\Desktop\AndroidSDK\android-sdk-windows\platforms\android-24\android.jar(java/lang/AutoCloseable.class): major version 52 is newer than 51, the highest major version supported by this compiler.
    6.   It is recommended that the compiler be upgraded.
    7. 2 warnings
    8.  
    I'm Currently Using 5.2.1f1

    I played the demo in the Editor but When I press any button nothing happens


    Edit: Fixed this, I forgot to change the jdk path on preferences.

    P.S. : Im new to networking

    Another thing is that, Im using Unity's Network Lobby on the asset store and I have no Idea how to integrate this asset to Unity's Network Lobby.
    Can you point where should I start? or as a beginner, is it much better for me to make my own lobby?
     
    Last edited: Nov 9, 2016
  50. legitplayer09

    legitplayer09

    Joined:
    Sep 27, 2016
    Posts:
    9
    How do i call OnLobbyServerCreateLobbyPlayer() as well as other UNet Lobby overrideable methods?
    It seems that it is not defined on the helper or can I edit the helper to call these methods?

    EDIT1: How do I spawn the lobby player prefab?

    EDIT2:
    Here is my AndroidBluetoothNetworkLobbyManager script, AndroidBluetoothNetworkManagerHelper is on the same object.

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Networking;
    3. using UnityEngine.UI;
    4.  
    5. namespace LostPolygon.AndroidBluetoothMultiplayer {
    6.     /// <summary>
    7.     /// Version of <see cref="NetworkLobbyManager"/> that disconnects
    8.     /// from the Bluetooth server when UNet client is stopped.
    9.     /// </summary>
    10.     [AddComponentMenu("Network/Android Bluetooth Multiplayer/AndroidBluetoothNetworkLobbyManager")]
    11.     public class AndroidBluetoothNetworkLobbyManager : NetworkLobbyManager {
    12.  
    13.         public AndroidBluetoothNetworkManagerHelper helper;
    14.         public GameObject StartPanel;
    15.         public GameObject BTLobbyPanel;
    16.         public Text Title;
    17.  
    18.         public override void OnStopClient() {
    19.             base.OnStopClient();
    20.  
    21. #if UNITY_ANDROID
    22.             // Stopping all Bluetooth connectivity on Unity networking disconnect event
    23.             AndroidBluetoothMultiplayer.Stop();
    24. #endif
    25.         }
    26.  
    27. #if UNITY_EDITOR
    28.         protected virtual void Reset() {
    29.             OnValidate();
    30.         }
    31.  
    32.         protected virtual void OnValidate() {
    33.             networkAddress = "127.0.0.1";
    34.         }
    35. #endif
    36.  
    37.         void Update(){
    38.             Title.text = "No. of Lobby Players : "+GameObject.FindGameObjectsWithTag ("BTLobbyPlayer").Length;
    39.             if (AndroidBluetoothMultiplayer.GetIsBluetoothEnabled () && helper.IsInitialized) {
    40.                 BTLobbyPanel.SetActive (true);
    41.                 StartPanel.SetActive (false);
    42.             } else {
    43.                 BTLobbyPanel.SetActive (false);
    44.                 StartPanel.SetActive (true);
    45.             }
    46.        
    47.         }
    48.  
    49.         public void startHost(){
    50.             helper.StartHost ();
    51.         }
    52.  
    53.         public override GameObject OnLobbyServerCreateLobbyPlayer (NetworkConnection conn, short playerControllerId)
    54.         {
    55.             GameObject obj = Instantiate (lobbyPlayerPrefab.gameObject) as GameObject;
    56.  
    57.             return obj;
    58.         }
    59.  
    60.     }
    61. }
     
    Last edited: Nov 15, 2016