Search Unity

Easy WiFi Controller- Turn your mobile phone into a controller!

Discussion in 'Assets and Asset Store' started by greggtwep16, Mar 9, 2015.

  1. mcmonk

    mcmonk

    Joined:
    Sep 22, 2014
    Posts:
    14
    I'm getting a weird error when i subscribe to on_connectionChanged.

    When i try to call functions outside the script I get this error:
    "get_isActiveAndEnabled can only be called from the main thread."

    When i just debug.log in the function it works fine?

    Code snippets:
    void Awake()
    {
    // subscrive to connection event
    EasyWiFiController.On_ConnectionsChanged += checkForConnections;
    }

    void checkForConnections(bool isConnect, int playerNumber)
    {
    if (isConnect) {
    Debug.Log ("Player connected :)");
    Debug.Log ("is Automatically assigned: " + playerNumber);

    } else {
    Debug.Log ("Player " + playerNumber + " disconnected :(");
    }

    // get the appropriate player pet panel to react to onoff status
    Panels[playerNumber].setPetActive(isConnect); // THIS IS THE STUFF THAT CAUSES PROBLEMS

    }​
     
  2. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    EWC is multithreaded for performance reasons and the checkForConnections method is called from a separate thread (the thread that is listening for traffic). Unity is not thread safe so they lock out the majority of their API from being called from a separate thread. Only select things can be done (like Debug.Log they allow from any thread). Inside your setPetActive method you are calling things that Unity does not allow from outside their main thread.

    Whenever this is the case in your script simply set a flag like a bool or something else that marks that during the main unity loop that something needs to be done (and then mark that flag to false when you've done the action). You can choose whatever method you want on the main loop that is appropriate (Update(), LateUpdate(), etc.) and just check your flag and do you action there.

    From time to time there is talk about Unity making more of their API thread safe but I wouldn't hold my breath for that to happen anytime soon.
     
  3. sscacsa

    sscacsa

    Joined:
    Jun 4, 2014
    Posts:
    1
    Hi,I have buy this asset!The problem comes to me is that on the client side when i create buttons on Scroll view(UGUI) .Build and run on my android pad ,i click these buttons on the Scroll view ,nothing happen!Can you explain why and please help me,because i have many buttons on my project !So i want to use scroll view gameobject!
     
  4. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Zip up your project and send it to the support email address on the asset store page and I can certainly take a look.
     
  5. flyingwasp

    flyingwasp

    Joined:
    Feb 26, 2017
    Posts:
    2
    hello,
    is the server really limited to 16 concurrent players? can that be extended? or did i misunderstand something..
     
  6. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    The actual max number of players that can be used depends totally on your wireless environment. If everything is wired this can be much higher, but assuming a typical home network and all the devices on wifi this is usually around the max without some form of lag. This is assuming 60 fps so each clients having under 20ms reaction time. You can effectively double this if sending out information at 30hz but then your latency is between 30 and 40 ms. What you are trying to do is not oversaturate your wireless spectrum with collisions that will cause lag.
     
  7. flyingwasp

    flyingwasp

    Joined:
    Feb 26, 2017
    Posts:
    2
    ok, thank you for the response
     
  8. andrewminton

    andrewminton

    Joined:
    Oct 5, 2016
    Posts:
    6
    Looks like a great package. Have been thinking about using this for an experiment between tablet and phone. Do you think it would be feasible to use this component to control action on an android phone from an android tablet?

    i.e. trigger scene playback on phone from a tablet?
     
  9. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Android to Android or any combination of the supported platforms can be done. One caveat though when trying to invoke methods/actions is that EWC is built around the concept of data streams which is best suited for controllers. For a controller if you move a joystick and send it over the wifi and is never recieved (it's networking happens rarely but does happen) there is no point to resending. Even if you did resend 1/60th of a second has surely gone by and you have a new more up to date value that is sent rather than trying to mess with sending anything old. While this works great for data streams and is much faster, remotely calling a method has different concerns. In that same situation the method would act like it's never called without a lot of infrastructure for resending, timestamps, confirming packet recieved, etc.

    Since EWC is built around data streams if your looking to call a method it would be best to send out your flag for calling the method a few times (say 2 or 3 frames so 1/20th of a second) to make the odds of never receiving almost zero. It can be done and other buyers certainly have done so but it does go against the design a bit. If your only requirement was this and is the only reason for buying, I would probably point you to a product that has RPCs/RMI built in like Photon or Bolt. I haven't used either but I believe they both have this built in. If your main reason for buying is the controller functionality but you also want to do some actions, that's fine and you can bend EWC to do what you want.
     
  10. andrewminton

    andrewminton

    Joined:
    Oct 5, 2016
    Posts:
    6
    Thanks so much for your response Greg, We're investigating Palliative care with Gear VR and using the tablet as a controller to navigate scenes on behalf of the patient. So I saw EWC as a means to trigger video playback using custom methods that listen for button triggers from the tablet to the phone. The button controllers with custom script that triggers my loadScene function would be perfect. If you think that this is overkill for what I'm after, then no worries, but it does seem like a nice solution to one to one device messaging using UDP for simplicity. Thoughts? i.e. not looking to use the DPad or anything, mainly navigate scenes using tablet as controller for phone scenes in GearVR experience for patient. Thanks.
     
  11. andrewminton

    andrewminton

    Joined:
    Oct 5, 2016
    Posts:
    6
    Also just noticed that when triggering a scene change that may not have an associated button object in the scene.. i.e. 360 video player, wasn't sure what I'd attached the EasyWifiController module to? an object in the scene? My own Event system? Wasn't clear. Button triggers work like a charm though
     
  12. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    The video playback from a button or scene switching shouldn't be a problem. I'm not entirely clear on what your question is but my impression is knowing what to attach the server button script to in your server scene?

    If so it usually makes sense to put it on the gameobject in the scene that you are going to call the method on. So if you had an object that has a method to play the video in your own script it would make sense to put the customButtonServerController on that object and then put in the notify method the name of your function.
     
  13. andrewminton

    andrewminton

    Joined:
    Oct 5, 2016
    Posts:
    6
    That's exactly what I'm trying to do Greg! thanks. Attaching it to the GameObject for the 360 video player should do the trick. Will report back when I've dabbled a bit further. Cheers for your support. first class.

    Last item to query is whether I need the EasyWifiManager in my video player scene at all? Or is the custom button controller sufficient to receive the stream of data?
     
    Last edited: Aug 31, 2017
  14. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    EasyWifiManager is what handles all the streams so yes it is required if you are using EWC.
     
    andrewminton likes this.
  15. FNN_1

    FNN_1

    Joined:
    Apr 1, 2017
    Posts:
    2
    Hi, i purchased the assets and its great!! but I am working on an application where there is a server and several cell phones connect with their wifi controller and once connected spawn a character, but the problem is that the characters are only controlled by the player 1 and I need each user to control his character spawn (player 2,3,4,etc) . Players are not on the stage until the user connects. Can yo help me please? Thanks a lot!!
     
  16. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    The MultiplayerControllerSelect Example shows you how to achieve this. In that example it spawned a badge for each player when they connected. The same premise would work for a character or any other prefab.
     
  17. kreso

    kreso

    Joined:
    Sep 7, 2013
    Posts:
    147
    Hello @greggtwep16,
    I'm finally implementing the EWFC into my game.
    I am looking into the MultiplayerControllerSelectServerScenes... but it is too complicated for my needs.

    I need every controller that connects (on select screen) to show as 'available'.
    I am guessing I do this via "EasyWiFiController.On_ConnectionsChanged += newWiFiConnection;"
    In there "void newWiFiConnection(bool isConnect, int playerNumber)" I can know which controller this corresponds to via playerNumber.

    So let's assume there are 2 players. 2 connections happen, and then I want to drag each connected controller to a player slot.
    In my game I have a character on left (Player 1) and character on the right (Player 2).
    For example; controller with playerNumber=0, will be dragged to my player 2 slot. And I drag controller with playerNumber=1, to my player 1 slot.


    So now:
    My Player 1 = playerNumber 2
    My Player 2 = playerNumber 1

    How can I actually read the preferred player's input in the game?
    I want the client to control the character which slot they occupied on the screen before.
    And I have predetermined that My Player1 is on the left, and My Player 2 is on the right side.

    I notice the 'Player' enum on different controllers. Is it simply by setting those to previously saved My Player values?

    Thank you for your help, and I hope this makes sense :)

    Kreso
     
  18. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Hi Kreso,

    Can you further explain how this is different from the example? (I read it a couple of times but it sounded like the example)

    To talk in detail about the example, basically what you outlined above is possible in that example. If you did what you described above (have two phones 1/2 connect and then have phone 2 pick player 1 and phone 1 pick player 2) it would behave as you describe when the game started.

    What actually happens in the example is when the players ready up to start the game scene and exit the player select scene is the player numbers are swapped based on the selections). That way your game scene is nice and straightforward, you simply have your character on the left's inspector set to player 1 and the one on the right set to player 2. That scene is none the wiser that the phone was originally a different player number it simply is reacting to what is player 1 now.

    The player numbers is the player select scene is based on order of connection (when the phone runs the app). So if you have 8 phones, 1st to connect is player 1, 2nd to connect is player 2, etc (this is how EWC by default behaves). That player select scene simply spawns a badge for each player when that callback you mentioned is called when the phone connects. The phone simply moves the badge on the player number they want to be and it will become that player number before the game starts.

    If I'm missing something let me know.
     
    Last edited: Oct 23, 2017
    kreso likes this.
  19. kreso

    kreso

    Joined:
    Sep 7, 2013
    Posts:
    147
    Thanks for the quick response @greggtwep16
    I carefully read your answer, and implemented the solution to my game without a problem.
    I might have been overthinking the problem :)

    I have another question, could you please help me?
    On my /2 Player' scene, players select (drag & drop) active controllers into P1 or P2 slots.
    On this scene is also the link to 'WiFi Controller' Scene.

    On '2Player' scene I am simply using EasyWiFiManager Monobehavior, with Auto-connect on. Server.
    On 'WiFI Controller' scene, I am trying to stop the server (from previous scene) and run the client with this command:

    Code (CSharp):
    1.         EasyWiFiController.initialize(EasyWiFiController.appName, EasyWiFiConstants.PEERTYPE_CLIENT, EasyWiFiController.serverSocketListenPort, EasyWiFiController.clientScoketListenPort, EasyWiFiController.isVerbose, false);
    2.  
    I don't think it works :)
    What would be the easiest way to stop the server - and start the client, on this new scene?

    I am enjoying using your asset. It has a lot of problems already solved, so it's easy to use.

    Thank you in advance for your help!
    Kreso
     
  20. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    If you look at the Awake method of EasyWifiManager it's designed to survive scene loads. In general you'll only need EasyWifiManager on your first scene and from then on that EasyWifiManager (and all it's connections with the phones) will survive any future scene you go to including your game scene.

    Most games have a linear progression of scenes menu -> player select -> game so you don't even need to put EasyWifiManager in the game scene since it will always be present from the player select scene.

    That being said if you do have a non linear flow with multiple entry points that it's not guaranteed to be there you'll notice in the awake method that EasyWifiManager it checks if there is another one already present and if so destroys itself. So even if you game is not linear and you put EasyWifiManager in multiple scenes, the first one created will survive accross all scene loads and other ones will be ignored and destroy itself.

    In general, you don't need to add/stop/restart EasyWifiManager to your game scene because it is already present and running from your player select scene. If you actually want to stop the server and drop all the phone connections (I would think this would be rare you usually want it to keep running) you could just make a script to destroy the running EasyWifiManager object and then if you wanted to restart it fresh, you'd spawn a new one. If you do this, make sure the phone clients have a timeout set so that when the server disappears that they go back to discovery mode so when you make a fresh server they'll connect to the new server.

    Hope that helps.
     
    Last edited: Oct 28, 2017
  21. kreso

    kreso

    Joined:
    Sep 7, 2013
    Posts:
    147
    Thanks @greggtwep16
    I get what you are saying, but guess I wasn’t clear what my question is :)

    My game is linear in the way you say.

    I’ll try to make it simple. How do I tell EWFC to stop listening as server, and start acting as a client (broadcasting).

    I can explain my situation in more details, but that is my question.

    My setup:
    Scene ‘2p game’ with assign controller to player slot.
    This is also EWFC server.
    Here are 2 buttons.
    ‘Start game’ (enabled only after both player slots are assigned).
    And ‘wifi controller’ (opens the client scene).

    progression will be like this:
    1. Player 1: open ‘2p game’ (is now server). Is assigned into player slot automatically.
    2. Player 2: open ‘2p game’ (also server for now), then click ‘wifi controller’. He should turn into client now.
    3. Player 1 (1st server) now sees player 2, assigns his controller to player slot - and starts the game.

    Thank you for your help! We’ll get to the bottom of this :)

    Kreso
     
  22. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Ah, it's a little clearer now. So there is no real obvious "server" like an apple tv, PC, or something else that the phones all connect to, you are actually trying to make a p2p multiplayer game over wifi with EWC and arbitrarily one of the phones is the "server" and the other is the "client" and they connect to eachother.

    In general this is possible, but I'm not sure EWC is the best tool for the job. It's more designed for when there is a true server, because in the arrangement that you have whichever node is the "server" will have a slight advantage (because the game is running on his device).

    In general, if you want to do what your describing others that have done the same with EWC usually just have two buttons on their main menu, one for host game, and another for join game. Clicking host game will go to a scene where it has a EasyWifiManager in server mode, and going to join game will go to one with EasyWifiManager in client mode. In general the only player in this arrangement that uses EWC input controls is the client, on the server the player is actually doing input on the device the game is playing on so it would be silly to use input through a Wifi connection to localhost. On the server you would just use normal Unity input directly.

    Certainly let me know if you have any questions on this approach.
     
  23. kreso

    kreso

    Joined:
    Sep 7, 2013
    Posts:
    147
    Excellent @greggtwep16 - we are getting closer! :)

    I am familiar with the EWC architecture and already implemented it in my game! Everything is working dandy :)

    The problem I am having is that 2 separate scenes now have separate 'EasyWifiManager'. Since they are Singletons - only 1 will stay. So in my case, since first one was initialized as the Server - I'm screwed.

    In the case of your example - I already have 2 separate scenes. And I could just follow your simple example and make players chose 'client - server' before anything.
    The thing is - in my game - the EWC is only ONE of ways to control the game (you can also connect gamepads etc etc) so it doesn't make sense to use 'EWC way'... So 2 players for me means more abstract than just EWC. Actually - none of this really matters.

    Let me ask you this - in case of your example.
    Lets say one player selected 'server' and the other 'client'. All good here! 2 separate scenes - they just connect.
    BUT -- what if one player selected 'server' and the other selected 'server' as well. NOW - the other player says 'ooops' and wants to go back somehow - and select 'client'! --- that is what i want to achieve, but how? :)

    Getting closer! :)
     
  24. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    If you want to keep your current architecture instead of having two separate buttons on the main menu that is fine. In general to "stop" EWC you would destroy the current EasyWifiManager object and then spawn a new one with the settings you want (client, port numbers, etc.). I believe either making a prefab with these settings already selected, or setting them in code would work.

    Your initial approach of just calling initialize I believe would have done most of the work, but if you look at the start method of EasyWifiManager those repeating method calls wouldn't be setup. You could probably call start manually if you didn't want to destroy the "server" EasyWifiManager and then create a "client" EasyWifiManager, but it's probably cleaner to just destory the 1st and then make the 2nd (because you destroyed first the 2nd object will then stay).
     
  25. kreso

    kreso

    Joined:
    Sep 7, 2013
    Posts:
    147
    Thanks @greggtwep16 !
    I was able to destroy the previous instance, and create the one I wanted (client
    It works just as I hope it would!

    Now the problem is - after I destroy the client, and destroy that EasyWiFiManager, it will keep transmitting.
    The debug message I receive are:
    Code (CSharp):
    1. Sending controller data... Client_ControllerData:229:192.168.0.106DPad1#0,0,0,0
    2. 192.168.0.106Button1#0
    Code (CSharp):
    1. Client_Log:Sending controller data... Client_ControllerData:229:192.168.0.106DPad1#0,0,0,0
    2. 192.168.0.106Button1#0
    Code (CSharp):
    1. Object reference not set to an instance of an object
    2. UnityEngine.Debug:Log(Object)
    3. EasyWiFi.Core.EasyWiFiController:sendClientLog(String) (at Assets/Standard Assets/Easy WiFi Controller/Scripts/Core/EasyWiFiController.cs:345)
    4. EasyWiFi.Core.EasyWiFiController:sendWiFIControllerData(String) (at Assets/Standard Assets/Easy WiFi Controller/Scripts/Core/EasyWiFiController.cs:355)
    5. EasyWiFiManager:LateUpdate() (at Assets/Standard Assets/Easy WiFi Controller/Scripts/Core/EasyWiFiManager.cs:150)
    6.  
    I tried calling "EasyWiFiController.endUDPClientAndThread();" before Destroying it, but it didn't help.

    Also - maybe part of same problem. So Player 1 is always the server.
    Player 2 went from Server -> Client (connects nicely!), now Player 2 goes back to server, and yet again to client - and there is n connection.

    I am assuming something doesn't gets cleaned up properly.

    Any ideas?

    I don't want to make this sound too complicated.
    Basically, this would behavior is the same if there were 2 buttons like you suggest client/server. This same problem would happen there as well, if the player would click around the menu (client->server-client).
    Thinking this way - it would be basic functionality. Simply ensuring that the player can move freely in the menu, and the game still works. Right now - it doesn't seem so.

    Please let me know what you think.

    Much appreciate it!
     
    Last edited: Oct 29, 2017
  26. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    From the stack trace you sent I'm not sure it's a cleanup issue (certainly could be but not sure). Right now I'm leaning more of a timing issue with the 2 different threads.

    Before you destroy the client can you call EasyWifiController's sendDisconnect method. That should notify the server, but also change the client's state. I believe you can then proceed right away, but if the same thing happens, maybe try waiting for a tenth of a second.

    If both of those fail, do you have a project you could zip up and send to my email? That way I could debug over the next few days.
     
  27. kreso

    kreso

    Joined:
    Sep 7, 2013
    Posts:
    147
    @greggtwep16 Thank you for the update. And thanks for all your help so far.

    I tried the fix you suggest, and it sometimes works - sometimes not. Why - I have no idea. Again, something doesn't seem to clean up (by that I mean, I don't understand how EWC works in detail, so I am not sure how to 'reset' it).
    There are a lot of advanced scripts (like different controllers; dpad, joystick, button etc), and details in the scripts (touch/mouse..). So I just assumed that the backend is seamless & covered. It doesn't seem it is. It appears switching between scenes is not intended use - even though in my opinion it should be a very basic feature (it is a very real scenario that person navigating menu, wants to change their mind - everything still has to work).

    Right now sometimes I managed to get connection 3 times in a row. This happened once. More often it happens only once.
    Even though I destroy and sendDisconnect (0.25 sec before destroying), client still seems to be connected (client_log messages are logged). But honestly, due to threading (they confuse me), and I am not that familiar with EWC architecture - I don't know enough to have meaningful feedback.
    Bottom line: it need it to work, but it doesn't.

    I don't see any example in the scene that has the ability to go back and forth the scenes (choose client-or-server / client / server). It makes me feel you have never tested this feature. I tried it, and I'm reporting it not working.

    I would love to create a sample project for you to test, but there are simply too many thing to do for my game, to have it ready for release in only 8 days. I would really really appreciate your help with this!
    Perhaps you could create an example you would later ship with EWC, that would allow switching between client-server?
    I am not asking you to build something for my specific case (even though that's nice too :), if you can create an example with your suggested scenario; one scene choice (client/server), and 2 additional scenes for each. With buttons to navigate back and forth. You would encounter this problem yourself - and be able to solve it. And your fix would help me. And probably others wanting to implement EWC in their game.

    You created an amazing asset. I love the value it brings to my game. I really want to use it in my final version, which is approaching very fast.

    Again, thank you for all your help so far.

    Kind regards,
    Kreso

    P.S. As a side note - if changing script order in the editor helps, I would have no problem doing that (as a requirement to have EWC work). This is a minor thing to do for me. In case it helps.
     
  28. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    While the product is fairly tested (been out for 2.5 years and used in quite a few production games but no code is ever bug free) I don't think your usecase is tested much (actually starting a server, then starting a client, then starting a server) so I certainly could see there being a possible bug in the backend (not sure would have to step through your project to see if it's current settings or the backend).

    Most of the games that are using EWC for multiplayer (again wasn't the main thing I envisioned when creating the product) have separate buttons for join or host so in those cases it would be very unusual for a player to start the game hosting, play another game joining, and then play another game hosting all within one session. Even if someone had a few friends over likely some people get used to hosting and other get used to joining, and the primary goal I had with the product was things like fire tv and apple tv where that will always be the server and the phones will always be the client. I can redownload and reach out to some authors that have done so in production and see if I go through those steps if their products also have the same issue.

    Ideally though, I'd like to step through your current source in visual studio to make sure I'm finding the actual issue that you're having, instead of doing some guesswork. Even if the current form is rough or large in size is there something you could send my way in email? You don't need to do extra work to prepare the scene no need to polish it.

    If other products also exhibit the same symptoms and you can't send your repro I can certainly over the next few weeks try and create a repro scene and see if I can track down the issue on my own but recreating things don't always get the same results.
     
  29. kreso

    kreso

    Joined:
    Sep 7, 2013
    Posts:
    147
    Thank you for your response @greggtwep16
    I am sending you my project, thank you for looking into it. I really appreciate it.
    Is gregfriend @ your domain good email to reach you?

    Thank you!!
     
  30. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Yes, that's the main support email.
     
    kreso likes this.
  31. kdarius43

    kdarius43

    Joined:
    Mar 16, 2015
    Posts:
    170
    Hello,
    First of I am LOVING this asset. Saved me a huge amount of time. Im sorry if this question might be a novist level question but what I am trying to do i have the server have an opening scene(scene serverA) and the phone have a opening scene(scene clientA). When you push a button on the phone the server changes scenes to serverB and the phone changes scenes to clientB. Is this possible to do with this asset?
    Thank you very much.
     
  32. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Yes this is possible to do. In the examples we do showcase the server changing scenes in the multiplayer controller example. This is possible to do for the client as well. The EasyWifiManager component that manages all of the connections is marked as dontDestroyOnLoad so it will survive any number of scene changes and keep the already connected devices. So in general you'll only need that component on the first scene not the second.

    The one thing to be aware of though is upon initial connection of devices the devices register all of their controls and their names (buttons, joysticks, touchpad, etc). If you're second client scene is just changing UI and graphics but will have the same number of controls (say 2 buttons and a joystick) then nothing needs to change just reuse the same names in the second scene. If the second scene instead has new stuff (ie. lets say it has a touchpad the first scene didn't have) then that would have to be registered in the first scene even if not used there, otherwise the server would never be checking it once you switched. This is fairly easy to do simply include the control in the first scene but either turn off it's renderer or move it off the visible part of the UI. That way the control is registered when it first connects and switching to the second scene the new controls are checked.

    This is fairly rare usually the client controls stay pretty constant and while you update the UI your control scheme and number of buttons stays the same.
     
  33. kreso

    kreso

    Joined:
    Sep 7, 2013
    Posts:
    147
    Just putting it up here - for anyone wanting to switch scenes (between client - server).
    Greg and me corresponded over email and found an easy solution.

    pseudo code:

    And a BIG thank you to Greg for going out of his way to help me out. The asset was already top notch, but combined with Greg's support, I have only words of praise, and feel so grateful.

    My game is going to ROCK thanks to Easy WiFi Controller! And Greg ;-)
     
  34. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Thanks for the kind words kreso!
     
  35. eleworks

    eleworks

    Joined:
    Oct 15, 2017
    Posts:
    3
    hi,
    would i ask you answer my question,which version of android and API level use to publish client in unity player settings?
    thanks.
     
  36. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    EWC doesn't impose any additional requirements for the newer minimum API so it would be dictated by the version of unity you're using. You should be able to go as far back as you want.
     
  37. GIRsMySpritAnimal

    GIRsMySpritAnimal

    Joined:
    Jan 13, 2017
    Posts:
    45
    Does this work with UWP/Xbox One now?
     
  38. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Out of the box no for UWP. This is due to the way threading works differently on UWP. I've had some users report sporadic success if they use the IL2CPP backend (.NET definitely doesn't work) and modify the manifest. Never had it work reliably on UWP, hence why it isn't listed in the supported platforms.
     
  39. Architree

    Architree

    Joined:
    Oct 29, 2012
    Posts:
    6
    Hello, is this asset support Unity 2018.1 and above??
     
  40. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Currently it works on all versions through 2018.1. I've been made aware that unity's deprecation of the old networking has caused 2018.2 to throw errors. I'm working on resolving those currently and should be able to get an update out next week for 2018.2 and above.
     
  41. SprAmir

    SprAmir

    Joined:
    May 16, 2018
    Posts:
    9
    Hello,
    it's been a long time, there is still no support for 2018.2 ?
    Thank you!
     
  42. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    It's going through beta testing currently. Send our support email address your invoice number and I'll email you that beta. If I had to guess it will be submitted to the store next week.
     
  43. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    The fix is now live on the store.
     
    SprAmir likes this.
  44. SprAmir

    SprAmir

    Joined:
    May 16, 2018
    Posts:
    9
    Thank you, it works great!
     
    greggtwep16 likes this.
  45. Stage64

    Stage64

    Joined:
    Jul 27, 2016
    Posts:
    11
    With newer Unitys (2018.2+), I use 2018.2.14 on a Mac High Sierra I get the error below. On Unity 2018.1.7 it works.
    Can you help me?

    SocketException: No such host is known
    System.Net.Dns.GetHostByName (System.String hostName)
    System.Net.Dns.GetHostEntry (System.String hostNameOrAddress)
    EasyWiFi.Core.EasyWiFiController.getNetworkIPAddress () (at Assets/Easy WiFi Controller/Scripts/Core/EasyWiFiController.cs:1047)
    EasyWiFi.Core.EasyWiFiController.initialize (System.String name, System.String type, Int32 serverPort, Int32 clientPort, Boolean verbose, Boolean clientConnectAutomatically) (at Assets/Easy WiFi Controller/Scripts/Core/EasyWiFiController.cs:100)
    EasyWiFiManager.Awake () (at Assets/Easy WiFi Controller/Scripts/Core/EasyWiFiManager.cs:63)
     
  46. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    I tested tonight here on various Unity versions and various versions of OSX without issue. Can you send me your log when this issue occurs and also let me know what your local network (not public) IP address is when you are encountering the issue.

    In general that specific error is thrown from .NET when lookup fails for instance when you aren't connected to the network or if you're in a corporate environment and the routers used don't respond to the lookup.
     
  47. sc7286

    sc7286

    Joined:
    Oct 13, 2018
    Posts:
    2
    Hi,
    This asset works great when my phone and my computer are connected to the same Wifi in my house, yet it stopped working when I tested in public wifi environment... I also tried to connect my computer and my phone to the same personal hotspot and it didn't work either. I can see from the console that my phone is broadcasting yet nothing is received on my computer. I'm not sure if it is the wifi's problem or there are any codes I should change in the scripts?
     
  48. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Their are likely two things in play here.

    1. Public wifi (as in unsecured) is fine, but businesses (stores, universities, companies, etc.) usually use commercial routers that automatically block a lot of stuff including p2p style traffic. That is likely causing the issue but certainly tell me more about the public network you are using.

    2. For the phone hotspot the issue is likely that the phone doesn't join the wifi network that it creates (most don't). So if you are trying the phone that made the hotspot with another device it doesn't work, but if you try 2 devices that aren't the hotspot host (phone or PC) it will work.

    Certainly let me know if you have any other questions.
     
  49. sc7286

    sc7286

    Joined:
    Oct 13, 2018
    Posts:
    2
    We are now using hotspot and things work out fine, thank you so much! I think it is because we were using the wifi from school and it is the p2p thing you mentioned that caused the problem.

    Yet there is one more thing with the backchannel. We tried to connect multiple phones to a computer and our game requires the computer to send an integer back to the phones. It succeeded sending that integer back, yet not to the correct phone we were expecting. The computer kept sending the integer to player 1 regardless of the player tags I set.

    I basically attached two IntServerBackChannel scripts to the EasyWifiManager, and set the control name exactly the same cause I think the client side should not change and there is no player tag written in the client backchannel scripts. Then I set the player tag in the IntServerBackChannel to Player1 and Player2 separately. I assume that although the scripts' names are the same, the program should be able to distinguish which one to use based on the player tags but that is not what is happening.
     
  50. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Can you send me the log from the server when you check "log verbose" on both the client and server build (that way the server log contains also the logs from all the clients). Send me the log when recreating what you've done above and I'll take a look.