所以我试图建立一个光子网络连接,玩家随机生成,但遇到了这个错误。"实例化"上没有重载



显示此错误

方法"实例化"没有重载需要三个参数

对于此行

PhotonNetwork.Instantiate(PlayerPrefabs.name, randomPosition, Quaternion.identity);
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Spawn_Player : MonoBehaviour
{
public GameObject PlayerPrefabs;
public float minx;
public float maxx;
public float miny;
public float maxy;

// Start is called before the first frame update
void Start()
{
Vector3 randomPosition = new Vector3(Random.Range(minx, maxx),1, Random.Range(miny,maxy));
PhotonNetwork.Instantiate(PlayerPrefabs.name, randomPosition, Quaternion.identity);

}
}
如果我没有错的话,

PhotonNetwork.Instantiate至少需要4个参数。

1.预制

2.位置

3.旋转

4.以及利益集团

此外,您可以添加用于自定义实例化数据的第五个参数。

最新更新