//============================================================================================================================================================
    // Aggregate function, that processes whole generation
    void CreatePuzzle()
    {
        Random.InitState(System.DateTime.Now.Millisecond);

        puzzleGrid = new PuzzleElement[cols * rows];

        try
        {
            image = TextureUtility.PrepareAsset(image);

            GeneratePuzzlePieces(cols, rows, subElement, elementBaseSize, image);
            CreateAtlas();
            ConvertToSprites();
            puzzle = CreateGameObjects().AddComponent <PuzzleController>();
            puzzle.Prepare();

            if (generateBackground)
            {
                puzzle.GenerateBackground(image);
            }
        }
        catch (System.Exception ex)
        {
            EditorUtility.DisplayDialog("ERROR", "SOMETHING GONE WRONG! \n \n" + ex.Message, "OK");
        }


        EditorUtility.ClearProgressBar();
    }