void Awake() { Manager = GetComponent <NetworkManager>(); Transport = GetComponent <IgnoranceTransport>(); Connection = new UdpClient(); Connection.BeginReceive(OnReceive, null); }
protected virtual void OnEnable() { _networkManager = GetComponent <NetworkManager>(); _transportLayer = GetComponent <IgnoranceTransport>(); // Setting the UUID. Must be unique for every application _isInitialized = AndroidBluetoothMultiplayer.Initialize(_bluetoothNetworkManagerSettings.Uuid); // Registering the event listeners AndroidBluetoothMultiplayer.ListeningStarted += OnBluetoothListeningStarted; AndroidBluetoothMultiplayer.ListeningStopped += OnBluetoothListeningStopped; AndroidBluetoothMultiplayer.AdapterEnabled += OnBluetoothAdapterEnabled; AndroidBluetoothMultiplayer.AdapterEnableFailed += OnBluetoothAdapterEnableFailed; AndroidBluetoothMultiplayer.AdapterDisabled += OnBluetoothAdapterDisabled; AndroidBluetoothMultiplayer.DiscoverabilityEnabled += OnBluetoothDiscoverabilityEnabled; AndroidBluetoothMultiplayer.DiscoverabilityEnableFailed += OnBluetoothDiscoverabilityEnableFailed; AndroidBluetoothMultiplayer.ConnectedToServer += OnBluetoothConnectedToServer; AndroidBluetoothMultiplayer.ConnectionToServerFailed += OnBluetoothConnectionToServerFailed; AndroidBluetoothMultiplayer.DisconnectedFromServer += OnBluetoothDisconnectedFromServer; AndroidBluetoothMultiplayer.ClientConnected += OnBluetoothClientConnected; AndroidBluetoothMultiplayer.ClientDisconnected += OnBluetoothClientDisconnected; AndroidBluetoothMultiplayer.DevicePicked += OnBluetoothDevicePicked; }