Search Unity

Network Events in Unet vs Legacy

Discussion in 'UNet' started by NotQuiteSmith, Oct 6, 2015.

  1. NotQuiteSmith

    NotQuiteSmith

    Joined:
    Oct 27, 2013
    Posts:
    92
    Hi,
    I'm following an older tutorial (Gamer To Game Developer:
    at 15:00) that uses MonoBehaviour.OnPlayerConnected to perform local data updates when a new player joins a game. This is part of the old Unity networking system I think. Could someone tell me, are these events still used in Unet (or what it their equivalent)? i.e. can I get ANY script to respond to network events (rather than channeling all network events through my custom Unet NetworkManager (e.g. I use NetworkManager.OnServerAddPlayer to spawn players, etc.)

    Thanks.
     
  2. Darhkuan

    Darhkuan

    Joined:
    Feb 24, 2014
    Posts:
    24
    There are a heap of specific events relating to the NetworkManager class, what I've done to utilise this is create my own custom Networkmanager as you have mentioned and created overrides for those events, i.e. onServerConnect, OnStartClient etc.

    I think of the network manager as the glue across my projects network components. If I need to have another script respond to one of those events I call to it from within my NetworkManager class, as that is where the "events" are all being handled.

    I've also found using the message class very helpful when trying to deal with general communication between various network connections.

    Hope that helps