为什么spawn'ed对象没有正确的名称&标签

时间:2016-08-21 10:23:26

标签: networking unity3d unity3d-unet

我使用以下代码生成预制件:

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”,每个预制件都有相同的标签。

有人可以请你给我一些我做错的提示吗?

0 个答案:

没有答案