I have it split up a bit.
I did the walls 100 x 5 (so yeah, 500 each) and there are four of those.
I think the ceiling is 50 x 50 and there are four of those too (10,000)
I did the floor smaller, 25 x 25 so there are 16 of those (10,000)
I was experimenting to see if creating the boundaries in smaller sections improved performance but it didn’t appear to.
Full script is:
function Start () {
Floor1();
Floor2();
Floor3();
Floor4();
Floor5();
Floor6();
Floor7();
Floor8();
Floor9();
Floor10();
Floor11();
Floor12();
Floor13();
Floor14();
Floor15();
Floor16();
Wall1();
Wall2();
Wall3();
Wall4();
Ceiling1();
Ceiling2();
Ceiling3();
Ceiling4();
}
//behind where player starts
function Wall1()
{
for (var y = 1.0; y < 5.0; y++) {
for (var x = 0.0; x < 100.0; x++) {
var cube = Instantiate(cube, Vector3 (x, y, 0.0), Quaternion.identity);
}
}
}
//in front of where player starts
function Wall2()
{
for (var y = 1.0; y < 5.0; y++) {
for (var x = 0.0; x < 100.0; x++) {
var cube = Instantiate(cube, Vector3 (x, y, 100.0), Quaternion.identity);
}
}
}
//left of where player starts
function Wall3()
{
for (var y = 1.0; y < 5.0; y++) {
for (var z = 0.0; z < 100.0; z++) {
var cube = Instantiate(cube, Vector3 (0.0, y, z), Quaternion.identity);
}
}
}
//right of where player starts
function Wall4()
{
for (var y = 0.0; y < 5.0; y++) {
for (var z = 0.0; z < 100.0; z++) {
var cube = Instantiate(cube, Vector3 (100.0, y, z), Quaternion.identity);
}
}
}
function Ceiling1() {
for (var x = 0.0; x < 50.0; x++) {
for (var z = 0.0; z < 50.0; z++) {
var cube = Instantiate(cube, Vector3 (x, 5.0, z), Quaternion.identity);
}
}
}
function Ceiling2() {
for (var x = 50.0; x < 100.0; x++) {
for (var z = 0.0; z < 50.0; z++) {
var cube = Instantiate(cube, Vector3 (x, 5.0, z), Quaternion.identity);
}
}
}
function Ceiling3() {
for (var x = 0.0; x < 50.0; x++) {
for (var z = 50.0; z < 100.0; z++) {
var cube = Instantiate(cube, Vector3 (x, 5.0, z), Quaternion.identity);
}
}
}
function Ceiling4() {
for (var x = 0.0; x < 50.0; x++) {
for (var z = 50.0; z < 100.0; z++) {
var cube = Instantiate(cube, Vector3 (x, 4.5, z), Quaternion.identity);
}
}
}
function Floor1() {
for (var x = 0; x < 25; x++) {
for (var z = 0; z < 25; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}
function Floor2() {
for (var x = 25; x < 50; x++) {
for (var z = 0; z < 25; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}
function Floor3() {
for (var x = 50; x < 75; x++) {
for (var z = 0; z < 25; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}
function Floor4() {
for (var x = 75; x < 100; x++) {
for (var z = 0; z < 25; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}
function Floor5() {
for (var x = 0; x < 25; x++) {
for (var z = 25; z < 50; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}
function Floor6() {
for (var x = 25; x < 50; x++) {
for (var z = 25; z < 50; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}
function Floor7() {
for (var x = 50; x < 75; x++) {
for (var z = 25; z < 50; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}
function Floor8() {
for (var x = 75; x < 100; x++) {
for (var z = 25; z < 50; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}
function Floor9() {
for (var x = 0; x < 25; x++) {
for (var z = 50; z < 75; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}
function Floor10() {
for (var x = 25; x < 50; x++) {
for (var z = 50; z < 75; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}
function Floor11() {
for (var x = 50; x < 75; x++) {
for (var z = 50; z < 75; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}
function Floor12() {
for (var x = 75; x < 100; x++) {
for (var z = 50; z < 75; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}
function Floor13() {
for (var x = 0; x < 25; x++) {
for (var z = 75; z < 100; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}
function Floor14() {
for (var x = 25; x < 50; x++) {
for (var z = 75; z < 100; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}
function Floor15() {
for (var x = 50; x < 75; x++) {
for (var z = 75; z < 100; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}
function Floor16() {
for (var x = 75; x < 100; x++) {
for (var z = 75; z < 100; z++) {
var cube = Instantiate(cube, Vector3 (x, 0, z), Quaternion.identity);
}
}
}