在Unity中实例化3D立方体形状的游戏对象预制

在Unity中实例化3D立方体形状的游戏对象预制,3d,instantiation,cube,prefab,3d,Instantiation,Cube,Prefab,我怎样才能使立方体游戏对象预置实例化,这样即使我改变预置的比例,它们也会一直接触 当前,如果我更改立方体的大小,立方体将被分隔。抱歉,这是一个非常简单的问题: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Gameplay : MonoBehaviour { public Transfo

我怎样才能使立方体游戏对象预置实例化,这样即使我改变预置的比例,它们也会一直接触

当前,如果我更改立方体的大小,立方体将被分隔。抱歉,这是一个非常简单的问题:

using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public class Gameplay : MonoBehaviour
    {   
    
        public Transform brick;
    
        public  int gridWidth=10;
        public int gridDepth=10;
        public int gridHeight=10;
    
        // Start is called before the first frame update
        void Start(){
    
            for (int y = 0; y < gridHeight; y=y+1) 
            {
                for (int z = 0; z < gridDepth; z=z+1) 
                {
                    for (int x = 0; x < gridWidth; x=x+1) 
                    {
                    Instantiate (brick, new Vector3 (x, y, z), Quaternion.identity);
                    }
                }
            }
        }
    }
使用系统集合;
使用System.Collections.Generic;
使用UnityEngine;
公共类游戏:单一行为
{   
公共转换砖;
公共int gridWidth=10;
公共网格深度=10;
公共网格高度=10;
//在第一帧更新之前调用Start
void Start(){
对于(int y=0;y
本质上,我希望从实例化的游戏对象立方体中得到一个3d立方体,通过检查器可以得到任意数量的立方体

谢谢