【发布时间】:2019-12-22 14:33:31
【问题描述】:
我正在创建一个播放器Prefab,如果播放器连接到服务器,它应该会生成。
我一直在测试 Prefabs,它正在生成但不在我想要的位置。
有人可以帮我解决我的问题吗?
这是我的定位点函数:
public class PointJSON
{
public float[] position;
public PointJSON(SpawnPoint spawnPoint)
{
//* Position
position = new float[]
{
spawnPoint.transform.position.x,
spawnPoint.transform.position.y,
};
}
}
这是我实例化的GameObject:
userJSON currentUserJSON = userJSON.CreateFromJSON(data);
Vector2 position = new Vector2(currentUserJSON.position[0],currentUserJSON.position[1]);
GameObject p = Instantiate(player, position, Quaternion.identity) as GameObject;
【问题讨论】: