Search Unity

LLAPI problems when using two editor projects with same code

Discussion in 'Multiplayer' started by terravires, Jul 26, 2015.

  1. terravires

    terravires

    Joined:
    Mar 27, 2013
    Posts:
    103
    Would someone be able to confirm a bug(s) with LLAPI and two separate projects for me?

    I'm not sure, but it appears that I hit a bug when using client and server split across two scenes and editor instances.

    I get errors on NetworkTransport.Send() ONLY when trying to make a dedicated server. Connect, config, init, etc. all return successful and I have no other errors. But when I try to use NetworkTransport.Send() I see this on the client:

    Attempt to send to not connected connection {1}
    UnityEngine.Networking.NetworkTransport:Send(Int32, Int32, Int32, Byte[], Int32, Byte&)


    And error gets set to: Error: WrongConnection


    Code (csharp):
    1. _connectionID = NetworkTransport.Connect(_hostID, serverHostname, port, 0, out error);
    2. (snip)
    3. NetworkTransport.Send(_hostID,  _connectionID,  channelID,  writer.AsArray(), (int)writer.Position,  out error);
    However, connection, channel and host ID all appear valid. If I put both server and client scripts in the same scene and editor instance, it works. Yet once moved to a different editor process (client / server), it gives me errors. The Assets folder is symlink between the both projects so all the code is the same data.
     
    belaissi likes this.
  2. terravires

    terravires

    Joined:
    Mar 27, 2013
    Posts:
    103
    Is anyone able to test and confirm this? As I said it works in the same scene, but when I use two different projects then it fails. This is a bug and not by design right? :)
     
  3. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    I am not sure about this, but every project seems to generate its own kind of project key which must match in order to connect properly. Thus you can only connect to clients that originate from the same build/project

    Note that this is just what I have understood, I may be completely wrong here so please correct me if thats the case.
     
  4. terravires

    terravires

    Joined:
    Mar 27, 2013
    Posts:
    103
    I knew that they do a CRC check on scripts for HLAPI stuff, but the LLAPI shouldn't be effected by it... at least I think. :) Using HLAPI you get CRC mismatch if scripts are out of sync when you connect. But that's not the problem here since I can connect in both cases. It just appears the NetworkTransport.Send() is the problem.
     
  5. mike950

    mike950

    Joined:
    Sep 30, 2012
    Posts:
    94
    same problem
     
  6. Alex-Lian

    Alex-Lian

    Guest

    I'm assuming this is not a 5.2 specific problem as UNet was _not_ modified for 5.2. Removing version from title (unless you can show regression) and shifting to network forum.

    Edit: Wrong statement, UNet had no real additions for 5.2 just bug fixes.
     
    Last edited by a moderator: Aug 7, 2015
  7. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    Have you received connect event before sending?
     
    ThaiCat likes this.
  8. mike950

    mike950

    Joined:
    Sep 30, 2012
    Posts:
    94
    You're right! Forgot to add receive...
    Now if I could only get the the webgl client to talk to the editor server.
    Has that been tested and known to work?
     
  9. terravires

    terravires

    Joined:
    Mar 27, 2013
    Posts:
    103
    I did get it working in 5.1 so this was a 5.2 issue.

    Yes I did, please read the first post.

    "Connect, config, init, etc. all return successful and I have no other errors."
     
  10. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
  11. belaissi

    belaissi

    Joined:
    Nov 29, 2015
    Posts:
    1
    Thank you for identifying a bug "terravires". same problem. +++++++++
    LLAPI problems when using two editor projects with same code
     
  12. edencraig

    edencraig

    Joined:
    Sep 8, 2014
    Posts:
    2
    Did you manage to get this to work across multiple editors? I'm struggling with the same scenario now.
     
  13. terravires

    terravires

    Joined:
    Mar 27, 2013
    Posts:
    103
    Yeah I did, I quit using UNET and made my own with raw .Net sockets. :D
     
    edencraig likes this.
  14. edencraig

    edencraig

    Joined:
    Sep 8, 2014
    Posts:
    2
    I quit using NetworkTransport.Send and used the NetworkClient & NetworkServer instead. I only needed to send simple messages across the network to capture user details in a seperate iPad app before playing a VR game on a machine during exhibitions.

    I've a strong feeling it's a security feature hidden away in the LLAPI somewher that's stopping it across different builds.
     
  15. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    Guys we are not wizards, without project or bugs opened (with repro steps) we cannot identify your problems.. :(

    Sorry about this :(
    Alex
     
  16. jamy015

    jamy015

    Joined:
    Jun 1, 2017
    Posts:
    2
    I appear to be having the same problem. The client says it's connected, but 'connected' debug message is never logged on the server. Furthermore, when I send a message I get 'attempt to send to not connected connection'. I've made two small projects showing the problem, since they're too large to attach to this post please find them at this link (click the download button at the top right): https://drive.google.com/file/d/0B7MVH02QgFwda0RJTlV6WHp1UXc/view?usp=sharing

    Repro steps:
    1. Start the 'server sandbox' project on the single scene that's in there. Observe that a 'listening' message is logged to the console
    2. In a separate editor, start the 'Unity sandbox' project on the single scene that's in there. Observe that a 'connected' message is logged to the console, BUT no corresponding 'client connected' message is logged on the server
    3. Click the 'send message to server' button and observe that a warning 'Attempt to send to not connected connection' is sent to the console
     
  17. Tkaewkunha

    Tkaewkunha

    Joined:
    Jun 28, 2016
    Posts:
    13
    @jamy015 I have same issue as you. Have you found solution, please help me.
     
  18. jamy015

    jamy015

    Joined:
    Jun 1, 2017
    Posts:
    2
    @Tkaewkunha I haven't found a solution, sadly. Hopefully, someone from Unity can look at the projects I posted and weigh in on the issue.

    @aabramychev
     
  19. tomgie

    tomgie

    Joined:
    Jun 6, 2015
    Posts:
    4
    Bump. Anyone still got the same problem or is this resolved?