ClientScene.SendReconnectMessage

매뉴얼로 전환
public static bool SendReconnectMessage (Networking.MessageBase extraMessage);

파라미터

extraMessageAny extra data to send.

반환

bool Returns true if the send succeeded.

설명

Send a reconnect message to the new host, used during host migration.

An example usage might be that if you decide to spawn your own player and not use the built in "Auto Create Player" property in the NetworkManager together with HostMigration, you would need to send a reconnect message when your client reconnects. The code below illustrates such an example were we OnClientConnect check if we where disconnected from the host and in that case we send the reconnect message.

using UnityEngine;
using UnityEngine.Networking;

public class NetworkManagerEx : NetworkManager { public override void OnClientConnect(NetworkConnection conn) { base.OnClientConnect(conn);

if (migrationManager.disconnectedFromHost) { ClientScene.SendReconnectMessage(null); } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961