Version: 2017.3
public bool ReconnectPlayerForConnection (Networking.NetworkConnection newConnection, GameObject oldPlayer, int oldConnectionId, short playerControllerId);

パラメーター

newConnection 新しいクライアントの接続
oldPlayer プレイヤーオブジェクト
oldConnectionId 旧ホスト上のクライアントの connectionId
playerControllerId 再加入するプレイヤーの playerControllerId

戻り値

bool このプレイヤーの再加入が可能な場合は true

説明

プレイヤーオブジェクトを再接続されたクライアントとともに再構築する。NetworkServer.AddPlayerForConnection() に類似。プレイヤーゲームオブジェクトは新しい接続のプレイヤーオブジェクトとなる。

OnServerReconnectPlayer のデフォルト実装によって呼び出されます。

using UnityEngine;
using UnityEngine.Networking;

class MyMigrationManager : NetworkMigrationManager { protected override void OnServerReconnectPlayer(NetworkConnection newConnection, GameObject oldPlayer, int oldConnectionId, short playerControllerId) { Debug.Log("Reconnecting oldPlayer:" + oldPlayer); ReconnectPlayerForConnection(newConnection, oldPlayer, oldConnectionId, playerControllerId); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961