networkserver connectionId 是否像一个统一的列表?

is the networkserver connectionId like an list in unity?

嗨,我一直在想这个问题,但似乎无法得到答案。
我的问题是。 networkServer connectionId 是否像 unity c# 中的列表?

我是这样想的。 假设我们有两个玩家连接到服务器。

player_1 = connectionId 0   
player_2 = connectionId 1

假设 player_1 断开连接会发生什么。这会使 player_2 向下移动到第一行并获得 player_1 的 connectionId 吗?

player_1 = disconnected(no connectionId then)  
player_2 = connectionId 0  

还是他会留在同一个connectionId?如果是这样,如果第三个玩家连接会发生什么?他会被设置在线路前面并使用 player_1 的旧 connectionId 吗?

player_3 = connectionId 0  
player_2 = connectionId 1  

或者他会排在队伍的后面吗?并获得一个新的 connectionId

player_1 = disconnected(no connectionId then)  
player_2 = connectionId 1  
player_3 = connectionId 2

what would happen if let's say player_1 disconnects. would that make player_2 move down to the first row and get the connectionId of player_1?

没有.

or would he stay at the same connectionId? and if so what would happen if a third player connects? would he be set in front of the line and take player_1's old connectionId?

每个连接都有一个唯一 ID。

每当您感到困惑时,请阅读 API 的 Documentation

引自文档:

Unique identifier for this connection that is assigned by the transport layer.

On a server, this Id is unique for every connection on the server. On a client this Id is local to the client, it is not the same as the Id on the server for this connection.

因此,当 其他 NetworkConnection 连接或断开连接时,ID 保持不变。

NetworkConnection.connectionId 的值唯一可能改变的时间是 device/client 断开并再次连接时。在这种情况下,它会在再次重新连接时提供另一个 ID,但这不应该影响仍然连接的 devices/clients。他们的 ID 应该仍然保持不变。