我想要统一实例化的 gameobj 的值,该值位于其他脚本中的光子网络上,以便我的相机可以跟随玩家
public class playeri : MonoBehaviourPunCallbacks
{
public GameObject[] playerprefab = new GameObject[1];
public Transform[] spawnpoints; //THIS IS THE SPAWN POINTS FROM WEHRE THE player comes out
void Start()
{
// PhotonNetwork.LoadLevel(1);
//followplayer a = GetComponent<followplayer>();
print("hello");
int randomnumber = Random.Range(0, spawnpoints.Length);
Transform spawnpoint = spawnpoints[randomnumber];
int random = Random.Range(0, playerprefab.Length);
GameObject playertosp = playerprefab[random];
GameObject target = PhotonNetwork.Instantiate(playertosp.name, spawnpoint.position,
Quaternion.identity);
}
我遇到的问题是,
我希望我的相机跟随在光子上实例化的玩家,所以有人可以告诉我我该怎么做吗?我很困惑,所以请告诉我这一点
public class playeri : MonoBehaviourPunCallbacks
{
public GameObject[] playerprefab = new GameObject[1];
public Transform[] spawnpoints; //THIS IS THE SPAWN POINTS FROM WEHRE THE player comes out
void Start()
{
// PhotonNetwork.LoadLevel(1);
//followplayer a = GetComponent<followplayer>();
print("hello");
int randomnumber = Random.Range(0, spawnpoints.Length);
Transform spawnpoint = spawnpoints[randomnumber];
int random = Random.Range(0, playerprefab.Length);
GameObject playertosp = playerprefab[random];
GameObject target = PhotonNetwork.Instantiate(playertosp.name, spawnpoint.position,
Quaternion.identity);
}
}
what issue I have is that I want my camera to follow the player that is instantiate over the photon so can anyone tell me how can I do this I am very confused so tell me about this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论