/// <summary>
        /// Initializes shared tilemaps of a given level.
        /// </summary>
        /// <param name="level">Generated level.</param>
        /// <param name="mode">Tilemap layers mode.</param>
        /// <param name="defaultTilemapLayersHandler">Default tilemap layers handler. Used for the Default mode.</param>
        /// <param name="customTilemapLayersHandler">Custom tilemap layers handler. Used for the Custom mode.</param>
        /// <param name="example">Example game object for tilemaps structure. Used for the FromExample mode.</param>
        public static void InitializeSharedTilemaps(GeneratedLevel level, TilemapLayersStructureModeGrid2D mode, ITilemapLayersHandlerGrid2D defaultTilemapLayersHandler, ITilemapLayersHandlerGrid2D customTilemapLayersHandler, GameObject example)
        {
            GameObject tilemapsRoot;

            if (mode == TilemapLayersStructureModeGrid2D.FromExample)
            {
                if (example == null)
                {
                    throw new ConfigurationException($"When {nameof(PostProcessingConfigGrid2D.TilemapLayersStructure)} is set to {nameof(TilemapLayersStructureModeGrid2D.FromExample)}, {nameof(PostProcessingConfigGrid2D.TilemapLayersExample)} must not be null. Please set the field in the Dungeon Generator component.");
                }

                var tilemapsSource     = example;
                var tilemapsSourceRoot = RoomTemplateUtilsGrid2D.GetTilemapsRoot(tilemapsSource);

                if (tilemapsSourceRoot == tilemapsSource)
                {
                    throw new ConfigurationException($"Given {nameof(PostProcessingConfigGrid2D.TilemapLayersExample)} is not valid as it does not contain a game object called {GeneratorConstantsGrid2D.TilemapsRootName} that holds individual tilemap layers.");
                }

                tilemapsRoot      = Object.Instantiate(tilemapsSourceRoot, level.RootGameObject.transform);
                tilemapsRoot.name = GeneratorConstantsGrid2D.TilemapsRootName;

                foreach (var tilemap in tilemapsRoot.GetComponentsInChildren <Tilemap>())
                {
                    tilemap.ClearAllTiles();
                }
            }
            else
            {
                // Initialize GameObject that will hold tilemaps
                tilemapsRoot = new GameObject(GeneratorConstantsGrid2D.TilemapsRootName);
                tilemapsRoot.transform.parent = level.RootGameObject.transform;

                if (mode == TilemapLayersStructureModeGrid2D.Default)
                {
                    defaultTilemapLayersHandler.InitializeTilemaps(tilemapsRoot);
                }
                else if (mode == TilemapLayersStructureModeGrid2D.Custom)
                {
                    if (customTilemapLayersHandler == null)
                    {
                        throw new ConfigurationException($"When {nameof(PostProcessingConfigGrid2D.TilemapLayersStructure)} is set to {nameof(TilemapLayersStructureModeGrid2D.Custom)}, {nameof(PostProcessingConfigGrid2D.TilemapLayersHandler)} must not be null. Please set the field in the Dungeon Generator component.");
                    }

                    customTilemapLayersHandler.InitializeTilemaps(tilemapsRoot);
                }
            }
        }
 /// <summary>
 /// Initializes shared tilemaps of a given level.
 /// </summary>
 /// <param name="level">Generated level.</param>
 /// <param name="mode">Tilemap layers mode.</param>
 /// <param name="defaultTilemapLayersHandler">Default tilemap layers handler. Used for the Default mode.</param>
 /// <param name="customTilemapLayersHandler">Custom tilemap layers handler. Used for the Custom mode.</param>
 /// <param name="example">Example game object for tilemaps structure. Used for the FromExample mode.</param>
 public static void InitializeSharedTilemaps(DungeonGeneratorLevelGrid2D level, TilemapLayersStructureModeGrid2D mode, ITilemapLayersHandlerGrid2D defaultTilemapLayersHandler, ITilemapLayersHandlerGrid2D customTilemapLayersHandler, GameObject example)
 {
     PostProcessUtils.InitializeSharedTilemaps(level, mode, defaultTilemapLayersHandler, customTilemapLayersHandler, example);
 }