A downloadable project

using UnityEngine;

public class WorldGenerator : MonoBehaviour

{

    public GameObject blockPrefab;

    public int width = 10;

    public int height = 10;

    public int depth = 10;

    void Start()

    {

        GenerateWorld();

    }

    void GenerateWorld()

    {

        for (int x = 0; x < width; x++)

        {

            for (int y = 0; y < height; y++)

            {

                for (int z = 0; z < depth; z++)

                {

                    GameObject block = Instantiate(blockPrefab, new Vector3(x, y, z), Quaternion.identity);

                    block.transform.SetParent(transform);

                }

            }

        }

    }

}

Leave a comment

Log in with itch.io to leave a comment.