Search Unity

[UNET]: What happens to networking when the player receives a phone call?

Discussion in 'UNet' started by Pallav-Nawani, Jun 30, 2016.

  1. Pallav-Nawani

    Pallav-Nawani

    Joined:
    Jul 28, 2014
    Posts:
    5
    I am building a multiplayer, turn based cards game. Since the answer to these question is not available in the docs, I am asking it here:
    The game uses HLAPI (NetworkClient and NetworkServer), and the client & server communicate exclusively with NetworkMessages, no RPC is used. What happens when:

    (a) The client on an android smartphone is connected to the server & playing, and the player suddenly receives a call? With the client disconnect, or will it continue to send messages, or will it stall, not accepting any messages?

    (b) The player is playing over 3G and suddenly decides to switch over to Wi-Fi with the game still running. Will the client disconnect, or will the game somehow continue to run and the client stays connected to the server?

    I have strange issue where the server does not receive the disconnect event for a looong time. My boss is now pressuring me hard, ANY pointers are appreciated!
     
  2. srylain

    srylain

    Joined:
    Sep 5, 2013
    Posts:
    159
    A: I'm assuming that if you enable your game to run in the background it would continue sending messages. If you're using the default NetworkManager script, there's a checkbox for enabling Run in Background. You generally don't want to do that on mobile though, as it will drain battery life.

    B: No idea, but it may depend on the device whether it'll stay connected. If your device is running the server you'll have a problem because the clients won't see the change in IP address and they'll continue sending data through 3G. If you're only running a client I'd assume that it'd be fine while switching networks, but again it might be device specific.