随机收集物品掉落在镜头视图中,但不在游戏视图中



我正在使用一个教程来从刷出点随机生成GoodItems。我在场景中看到它们落在产卵点,但在游戏视图中没有,它们只是看不见。这是怎么呢

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Spawn : MonoBehaviour
{
public Transform[] spawnPoints;
public GameObject goodItems;
// Start is called before the first frame update
void Start()
{
int randomIndex = Random.Range(0, spawnPoints.Length);
for (int i = 0; i < spawnPoints.Length; i++)
{
if (randomIndex != i)
{
Instantiate(goodItems, spawnPoints[i].position, Quaternion.identity);
}
}
}
// Update is called once per frame
void Update()
{

}
}

很难说,但也许spawnPoints对象的z轴值在相机的z轴值或相机的近剪切平面之后,或者远离相机的远剪切平面

最新更新