metahunt/Assets/assets/PBS Barrels and Crates/Scripts/CrateGridBuilder.cs
2024-02-11 13:53:18 +05:30

32 lines
602 B
C#

using UnityEngine;
using System.Collections;
public class CrateGridBuilder : MonoBehaviour
{
public GameObject cratePrefab;
public Vector3 XYZCount;
public float length;
public float width;
public float height;
public Vector3 XYZOffset;
void Start ()
{
for (int x = 0; x < XYZCount.x; x++)
{
for (int y = 0; y < XYZCount.y; y++)
{
for (int z = 0; z < XYZCount.z; z++)
{
Instantiate (cratePrefab,
new Vector3(
width * x + XYZOffset.x,
height * y + XYZOffset.y,
length * z + XYZOffset.z),
Quaternion.identity);
}
}
}
}
}