Runtime map generation

The following methods can be used to generate and build a map during runtime. Please see the runtime demo in the demo scenes for an example.

using TileWorld;

// Generate and build a map from scratch
// _merge = if the map should be merged after generation
TileWorldCreator.GenerateAndBuild( bool _merge );

// Only generate a map without building it

// Build a map after generation
// _coroutine = use coroutine to build map (recommended when using this at runtime)
// _merge = should the map be merged after generation
// _optimize = use the optimization pass (recommended)
TileWorldCreator.BuildMapComplete( bool _coroutine, bool _merge, bool _optimize );

Use existing configuration

When using an existing configuration, you only have to call the method:

GenerateAndBuild(bool _merge);

on the TileWorldCreator to generate and build a complete map.

If you only want to generate a map without building it, you can call:


You can access all configuration properties during runtime using:


Create a new configuration

Creating a new configuration during runtime is simple. Just follow these steps:

  • First we create a new configuration.
// Assign current configuration, this is important if we want to preserve the assigned tiles of the current configuration for the new config.
var _currentConfig = TileWorldCreator.configuration;
// Create a new configuration and set the preserve presets option to true
var _newConfig = TileWorldConfiguration.NewConfiguration(_currentConfig, true);
  • Then we assign the newly created configuration
TileWorldCreator.configuration = _newConfig;