Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity networking on different projects

Discussion in 'Multiplayer' started by desafas, Apr 7, 2016.

  1. desafas

    desafas

    Joined:
    Jan 6, 2015
    Posts:
    4
    Hello,

    I am really new to unity and what I am trying to build is mostly for educational purposes but I feel kind of lost and could use some help.

    The main idea is having two applications, one running on a windows pc and another on an android phone that could exchange data over LAN (probably using network discovery but this is not the point at the moment).
    By data I mean accelerometer values from the phone that will affect some kind of object on the windows client.
    That means I must send messages very fast.

    So I started looking into unity networking but then I realized I cannot have a network manager work in two different projects (or that my limited knowledge of unity does not allow me to do that).

    So my question is what are my options?
    Is there any way to achieve that using unity networking?
    Do I have to use some kind of socket server-client?

    Thanks in advance.
     
  2. Oshroth

    Oshroth

    Joined:
    Apr 28, 2014
    Posts:
    99
    In theory, if you are using matching network scripts between the two project, you may be able to use HLAPI UNet. But it can be hit or miss depending on build differences.
    If you use LLAPI you shouldn't have those issues since you completely control network traffic.
     
  3. gianox

    gianox

    Joined:
    May 30, 2015
    Posts:
    1
    I have been researching this a bit, it seems like when you are using separate projects, the NET ID is not syncronized, causing major issues with the standard network manager scripts. A solution seems to be having separate scenes in the same project, one for android, one for pc, and then only compile the scenes that are meant for the specific platform. Ex scene01Android and scene01PC
     
  4. desafas

    desafas

    Joined:
    Jan 6, 2015
    Posts:
    4
    Hello all and thanks for your replies!

    gianox I thought of that approach but I realised that if I ever wanted to create another project for PC I had to add the "android scene" on both, resulting in two different applications for android doing the same thing and I found that approach restrictive.

    After Oshroth pointed me to LLAPI I found this guide:
    http://www.robotmonkeybrain.com/good-enough-guide-to-unitys-unet-transport-layer-llapi/
    and managed to create two different apps to communicate through the local network.
    I don't know if I am doing anything wrong but it seems to be working.
     
  5. appels

    appels

    Joined:
    Jun 25, 2010
    Posts:
    2,687
  6. chambe89

    chambe89

    Joined:
    Dec 3, 2018
    Posts:
    2
    This post was extremely helpful, thanks guys