-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathBuildScene.cs
More file actions
33 lines (28 loc) · 846 Bytes
/
Copy pathBuildScene.cs
File metadata and controls
33 lines (28 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// instantiate stack of boxes
using UnityEngine;
namespace Unitycoder.Demos
{
public class BuildScene : MonoBehaviour
{
public Transform prefab;
public int width = 3;
public int heigth = 3;
public int depth = 3;
void Start()
{
Vector3 pos = Vector3.zero;
Vector3 o = prefab.GetComponent<Renderer>().bounds.size + new Vector3(0.03f, 0.03f, 0.03f);
for (int x = 0; x < width; x++)
{
for (int y = 0; y < heigth; y++)
{
for (int z = 0; z < depth; z++)
{
pos = new Vector3(x * o.x, y * o.y, z * o.z);
Instantiate(prefab, pos, Quaternion.identity);
}
}
}
}
}
}