Network.minimumAllocatableViewIDs 可分配最小ViewID数

static var minimumAllocatableViewIDs : int

Description描述

Get or set the minimum number of ViewID numbers in the ViewID pool given to clients by the server.

在ViewID池中获取或设置由服务器分配给客户端ViewID的最小数。

The ViewID pools are given to each player as he connects and are refreshed with new numbers if the player runs out. The server and clients should be in sync regarding this value. Setting this higher only on the server has the effect that he sends more view ID numbers to clients, than they really want. Setting this higher only on clients means they request more view IDs more often, for example twice in a row, as the pools received from the server don't contain enough numbers. The default value is 100.

当玩家使用新的数字连接并被刷新时,ViewID池被分配给每个玩家。服务器和客户端应该同步这个值。在服务器上设置的更高,将会发送比它们真正需要的更多视ID数到客户端。在客户端上设置更高,意味着它们需要更多视ID。例如当池需要的ID数,服务器中并不包含足够的数量,则会在一行中使用两次。默认值为100。

If a game instantiates a lot of new objects over the network on each client, like more than 100 network intantiations per minute, then this value should be set higher.

如果一个游戏通过网络实例化大量新的物体,例如每秒超过100个的网络实例,那么这个值需要被设置的更高。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Awake() {
		Network.minimumAllocatableViewIDs = 500;
	}
}
function Awake () {
	// Use a bigger view ID pool to allocate from
	// 使用更大的视图ID池来分配
	Network.minimumAllocatableViewIDs = 500;
}
最后修改:2011年4月2日 Saturday 14:35

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。