public void OnData (Networking.NetworkConnection conn, int receivedSize, int channelId);

Parámetros

connThe connection that data was received on.
channelIdThe channel that data was received on.
receivedSizeThe amount of data received.

Descripción

This virtual function can be overridden to perform custom functionality when data is received for a connection.

By default this function calls HandleData() which will process the data and invoke message handlers for any messages that it finds.

using UnityEngine;
using UnityEngine.Networking;

public abstract class ExampleScript : NetworkManager { byte[] msgBuffer = new byte[1024];

public virtual void OnData(NetworkConnection conn, int channelId, int receivedSize) { conn.TransportRecieve(msgBuffer, receivedSize, channelId); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961