No Description

Joseph Parker d1b28923ff use CurrentCulture decimal separator for xml weight floats 3 years ago
impl 655b3e7fb8 foundation is now on ground, with comments for future 4 sided foundations. Bug fix (adding upstream code that allows higher N with bigger training models) 4 years ago
.gitignore 730c3879ed gitignore 7 years ago
LICENSE.txt b2877cec24 adding LICENSE.txt at top level 7 years ago
OverlapWFC.cs 777af66a21 remove warnings and update some obsolute prefab api calls 4 years ago 3ad11c9ed4 fixed tiled name symmetry parsing for xml, added tutorial to 7 years ago
SimpleTiledWFC.cs 879c6370d7 SimpleTiledModel comp uses a Text Asset for xml instead of file path 6 years ago
TilePainter.cs 777af66a21 remove warnings and update some obsolute prefab api calls 4 years ago
Training.cs d1b28923ff use CurrentCulture decimal separator for xml weight floats 3 years ago

Unity WaveFunctionCollapse

A fork of with tools for the Unity Game engine.


Clone this repo under your projets Assets directory, or import a unity package asset from


video tutorial


Training components define sample data from their child objects. The contained objects must have a prefab connection. Rotation of objects are recorded. The OverlapWFC component will auto compile it's training on Start, in editor mode you will need to use the compile button.

Whitespace (no object) is recorded for the OverlapWFC, but ignored for the SimpleTiledWFC.

NOTE: for SimpleTiledWFC all prefabs must be located within an Assets/Resources directory!


Simple tilemap painting utility to help create training data. To paint, assign it's color prefab property and hover over the canvas region with the TilePainter's object selected.

Adding objects to the palette array will show them below the canvas area, palette or painted tiles can be sampled by holding the [s] key and clicking on them.

Note: You can drag a folder of prefabs from under Assets/Resources onto the palette array!


Generates output from a Training sample. On Start will compile it's training component, generate, and run.

NOTE: Using rotation specific tiles will only give nice results for symmetry 1 generation. Personally I like to use rotation for the overlap model, with a larger training area to make up for the loss of symetry variants.

  • seed: 0 for randomized
  • N: size of the overlap patterns (this is hidden in the inspector, as higher values can often freeze Unity)
  • Periodic Input: repeating sample pattern
  • Periodic Output: repeating output pattern
  • Symmetry: sample grid re-read with additional rotation/reflection variations. Note: rotation of sample tiles will only make sense for symmetry-1 output
  • Iterations: 0 will run until finished/unfinishable. Also used by incremental output.
  • Incremental: Runs iterations every update in play mode.


This model uses XML data representing legal tile neighbors. The Training component has a "record neighbors" command to generate these files, the file is saved to "Assets/{{}}.xml".

Whitespace is ignored in the neighbor scan, and can be used as margins to isolate neighbors. Training components have a weight array for neighbor xml.

NOTE: Prefabs must be located within Assets/Resources or a subdirectory within.


Tile symmetry class can be declared via the last letter of the prefab name, for example "GroundX" or "Road-T".

Note: L tiles have an initial orientation of



Both models have a public GameObject[,] rendering; 2d array that stores their output.