Version: 2017.3
public Networking.NetworkConnection connectionToClient ;

説明

この NetworkIdentity に関連付けられた接続。これはサーバー上のプレイヤーオブジェクトのみ有効です。

Use it to return details such as the connection’s identity, IP address and ready status.

//For this example to work, attach a NetworkIdentity component to your GameObject.
//Make sure your Scene has a NetworkManager and NetworkManagerHUD
//Attach this script to the GameObject, and it outputs the connection of your GameObject to the console.

using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Networking;

public class NetworkIdentityNetID : MonoBehaviour { NetworkIdentity m_Identity; //This is a TextMesh component that you attach to the child of the NetworkIdentity GameObject

void Start() { //Fetch the NetworkIdentity component of the GameObject m_Identity = GetComponent<NetworkIdentity>();

//Output to the console the connection associated with this NetworkIdentity Debug.Log("Connection : " + m_Identity.connectionToClient); } }