我使用以下代码生成预制件:
public override void OnStartServer() {
// LOAD THE MASTER LIST
foreach (string anObject in nameList) {
temp_GameObject = Instantiate (Resources.Load ("_BackSide")) as GameObject;
temp_GameObject.name = anObject;
temp_GameObject.tag = anObject;
NetworkServer.Spawn (temp_GameObject);
}
}
还尝试了以下相同的结果:
public override void OnStartClient () {
temp_GameObject = Resources.Load ("_BackSide") as GameObject;
temp_GameObject.name = "Zappa";
Instantiate (temp_GameObject);
NetworkServer.Spawn (temp_GameObject);
}
它在主机/客户端上完美运行,并且名称和标签是正确的。但是,在客户端/客户端上,所有预制件都被生成,但具有相同的名称“_BackSide”,并且每个预制件具有相同的标签。
有人能告诉我我做错了什么吗?