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. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Question Send variables over wifi?

Discussion in 'Multiplayer' started by MidnightCoffeeInc, Sep 3, 2020.

  1. MidnightCoffeeInc

    MidnightCoffeeInc

    Joined:
    Feb 28, 2017
    Posts:
    440
    So, I'm making a game for VR on my PC, and want to have an android companion app so non-VR players can interact with the game on the same wifi network, but I have no idea what the best way to do this is.

    All I need is to be able to send basic variables (Vector3 and Quaternion, possibly just split up into floats, if that's easier) and strings (to call functions on the PC) from the android device to the PC--no need to spawn prefabs anywhere (like what Mirror tries to do).

    Only those two devices should be connected, so I don't need complicated rooms or anything, and I want this to be as simple as possible, I don't like the idea of having to mess with a router just to get this set up.

    All tutorials out there are of two instances of the same application. This won't work for me because the two apps are completely different. (The android app will literally just be some UI elements, buttons, etc.)


    Is this possible? If so, what's the best way to do it? Bluetooth?

    Thanks! :)
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,824
    I'd take a look at available networking solutions to see if any fit your requirements. I'd start here.
    https://forum.unity.com/threads/wha...of-available-network-solutions-assets.609088/

    High level networking API's for Unity typically have both the server and client running the same scene. That won't work for you, so instead I'd look at low level options. If your other app isn't even Unity, you may instead need to just use the Socket class.
    https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.socket?view=netcore-3.1

    Sorry I don't know if VR has any specific networking requirements, and don't know anything about bluetooth. Though I've seen some bluetooth assets on the Asset Store you could investigate. Networking should work fine without router hassle if you put the two devices on the same subnet.
     
  3. MidnightCoffeeInc

    MidnightCoffeeInc

    Joined:
    Feb 28, 2017
    Posts:
    440
    I'll definitely check that out, thanks!
    VR doesn't have any requirements, I was just sharing that for context.