Constraints
The basic configuration of a generator involves setting up tiles, and painting those tiles to show how they can be placed next to each other.
This page documents further configuration you can do to tightly control the generation process.
Tile
The generator will automatically recognize any GameObjects in the scene with the TesseraTile component which are inside or adjacent to the generator area. These are tile constraints.
The generator will automatically ensure that any tiles it creates connect to the existing ones correctly, and won't generate tiles that overlap with it.
The tile used for the tile constraint does not need to be in the generator's tile list. You can use this for example, to place an elaborate set-piece manually, and then use Tessera to fill in all the nearby tiles.
A generator is set up and a few tiles manually placed.
When the generator is run, the new tiles join up with the placed tiles.
Using the API, you can control this behaviour even closer. First, disable the automatic detection of tiles with by setting searchInitialConstraints to false. Then you can supply your own initial constraints by setting initialConstraints. You need to call GetInitialConstraint to convert from TesseraTile components to constraints.
Skybox
Setting the skybox property of the generator will automatically constrain all tiles on the boundary of the tile area. The skybox should be a TesseraTile component. Whatever is painted on the top of the skybox, will constrain the top of every tile on the topmost layer of the generator. Similarly for the other sides of the cube.
In this example, the skybox has been used to force the bottom edge to be all paths, and the other edges to have no paths.
If a tile constraint and the skybox both apply at a particular location, the tile constraint takes precedence.
Generator Components
Note
Generator constraints are only available in Tessera Pro
There are some components that can be added to the generator to control the global behaviour of generation. These constraints are very powerful, but can use generation to fail more frequently.
At present the constraints are:
- CountConstraint - ensures the number of tiles in a given set is less than / more than a given number.
- MirrorConstraint - ensures the output remains symmetric.
- PathConstraint - ensures that there is a connected path between tiles, where you define which tiles connect to each other.
There is a tutorial on how to use path constraints.