using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Tilemaps; public class WFCGenerator : MonoBehaviour { public Tiles[] tiles; public TileBase Rules; public Vector2Int maxsize; public Tilemap ForeGround; public Tilemap BackGround; // Start is called before the first frame update void Start() { for(int i = 0; i < maxsize.x; i++) { for(int k = 0; k < maxsize.y; k++) { ForeGround.SetTile(new Vector3Int(i, k, 0), Rules); } } ForeGround.SetTile(new Vector3Int(5, 5, 0), tiles[0].tile); } // Update is called once per frame void Update() { } [System.Serializable] public struct Tiles { public TileBase tile; public int index; } }