GameObject GeneratePlatformWithTexture(GameObject platformGO, Texture2D texture)
        {
            //Move the Z position to the starting position over to the 3rd quadrant of the graph
            float startingHeight = -(texture.height + spacing * (texture.height - 2)) / 2;
            //Move the X position to the starting position over to the 3rd quadrant of the graph
            float startingWidth = -(texture.width + spacing * (texture.width - 2)) / 2;
            //Starting position of the shape
            Vector3 pos = new Vector3(startingWidth, -100, startingHeight);

            //Place the reference of the bricks in a 2d array
            GameObject[,] arrayOfBricks2D = new GameObject[texture.height, texture.width];
            //Pixels of the image mapped
            Color32[]       pixels            = texture.GetPixels32(0);
            int             indexOfPixel      = 0;
            PlatformManager platformComponent = platformGO.GetComponent <PlatformManager>();

            for (int i = 0; i < texture.height; ++i)
            {
                for (int j = 0; j < texture.width; ++j)
                {
                    //If the brick is in the ColorMapping, Instantiate a brick and set its parent to the platform GameObject
                    int indexOfColorInMap = colorMapping.IndexOfColor(pixels[indexOfPixel]);
                    if (indexOfColorInMap != -1)
                    {
                        GameObject b = colorMapping.bricks[indexOfColorInMap];
                        if (b != null)
                        {
                            arrayOfBricks2D[i, j] = Instantiate(b, pos, Quaternion.identity);

                            if (arrayOfBricks2D[i, j].GetComponent <VictoryTag>())
                            {
                                platformComponent.victoryPlatforms.Add(arrayOfBricks2D[i, j]);
                            }
                            else
                            {
                                platformComponent.normalPlatforms.Add(arrayOfBricks2D[i, j]);
                            }

                            arrayOfBricks2D[i, j].transform.SetParent(platformGO.transform);
                        }
                        if (indexOfColorInMap == 0)
                        {
                            startingPoint = arrayOfBricks2D[i, j].transform;
                        }
                        else if (indexOfColorInMap == 1)
                        {
                            GameObject temp = new GameObject();
                            temp.transform.position = pos;
                            temp.transform.SetParent(platformGO.transform);
                            platformComponent.startingAnchor = temp.transform;
                        }
                        else if (indexOfColorInMap == 2)
                        {
                            GameObject temp = new GameObject();
                            temp.transform.position = pos;
                            temp.transform.SetParent(platformGO.transform);
                            platformComponent.endAnchor = temp.transform;
                        }
                        else
                        {
                            Debug.LogWarning("The color has no mapping: " + pixels[indexOfPixel]);
                        }
                    }
                    pos.x += 1f + spacing;
                    indexOfPixel++;
                }
                pos.x  = startingWidth;
                pos.z += 1f + spacing;
            }
            Apply2DArrayToPlatformComponent(platformGO, arrayOfBricks2D);
            return(platformGO);
        }