Version: 2022.1
NetworkBehaviour
NetworkConnection

NetworkClient

Important: UNet is a deprecated solution, and a new Multiplayer and Networking Solution (Netcode for GameObjects) is under development. For more information and next steps see the information on the Unity Netcode for GameObjects website.

NetworkClient is a high-level API class that manages a network connection from a client to a server, and can send and receive messages between the client and the server. The NetworkClient class also helps to manage spawned network GameObjects, and routing of remote procedure call message and network events.

有关更多信息,请参阅 NetworkClient 脚本参考。

属性

属性: 功能:
serverIP 此客户端连接到的服务器的 IP 地址。
serverPort 此客户端连接到的服务器的端口。
connection NetworkClient 实例正在使用的 NetworkConnection 游戏对象。
handlers 已注册消息处理程序函数的集合。
numChannels 已配置 NetworkTransport QoS 通道的数量。
isConnected 如果客户端已连接到服务器,则为 true。
allClients 激活状态 NetworkClient(静态)的列表。
active 如果任何 NetworkClient 处于激活状态(静态),则为 true。
NetworkBehaviour
NetworkConnection