- 创建一个 C# Script 脚本,用于生成 Cube
- 把脚本挂到 Main Camera 下
- 脚本中创建变量,并把 cube 预制件拖进去
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpawnCube : MonoBehaviour
{
[SerializeField]
private GameObject cubePrefeb;
// Start is called before the first frame update
void Start(