Beispiel #1
0
    private void InitQuads()
    {
        Texture2D[,] slices = ImageSlicer.GetSlices(image, size);
        for (int y = 0; y < size; y++)
        {
            for (int x = 0; x < size; x++)
            {
                GameObject quad = GameObject.CreatePrimitive(PrimitiveType.Quad);
                quad.transform.position = new Vector3(x - (size / 2f) + 0.5f, y - (size / 2f) + 0.5f, 0f);
                quad.transform.parent   = transform;

                PuzzlePiece puzzlePiece = quad.AddComponent <PuzzlePiece>();
                puzzlePiece.OnPuzzlePiecePressed         += EnqueuePuzzlePiece;
                puzzlePiece.OnPuzzlePieceFinishedSliding += OnPuzzlePieceFinishedMoving;
                puzzlePiece.Init(new Vector2Int(x, y), slices[y, x]);
                _puzzle[x, y] = puzzlePiece;

                if (y == 0 && x == size - 1)
                {
                    _hiddenPiece = puzzlePiece;
                }
            }
        }

        Camera.main.orthographicSize = size * 0.55f;
    }
    void CreatePuzzle()
    {
        blocks = new Block[blocksPerLine, blocksPerLine];
        Texture2D[,] imageSlices = ImageSlicer.GetSlices(image, blocksPerLine);
        for (int y = 0; y < blocksPerLine; y++)
        {
            for (int x = 0; x < blocksPerLine; x++)
            {
                GameObject blockObject = GameObject.CreatePrimitive(PrimitiveType.Quad);
                blockObject.transform.position = -Vector2.one * (blocksPerLine - 1) * .5f + new Vector2(x, y);
                blockObject.transform.parent   = transform;

                Block block = blockObject.AddComponent <Block>();
                block.OnBlockPressed   += PlayerMoveBlockInput;
                block.OnFinishedMoving += OnBlockFinishedMoving;
                block.Init(new Vector2Int(x, y), imageSlices[x, y]);
                blocks[x, y] = block;

                if (y == blocksPerLine - 1 && x == 0)
                {
                    emptyBlock = block;
                }
            }
        }

        Camera.main.orthographicSize = blocksPerLine * .55f;
        inputs = new Queue <Block>();
    }
Beispiel #3
0
    public void InstantiateQuads(int blocksPerLine)
    {
        _blocks = new Block[blocksPerLine, blocksPerLine];
        var imageSlices = ImageSlicer.GetSlices(image, this.blocksPerLine);
        var offset      = blocksPerLine / 2f - 0.5f;

        for (int row = 0; row < blocksPerLine; row++)
        {
            for (int column = 0; column < blocksPerLine; column++)
            {
                var instantiatePosition = new Vector3(row - offset, column - offset, 0f);
                var quad = GameObject.CreatePrimitive(PrimitiveType.Quad);
                quad.transform.position = instantiatePosition;
                quad.transform.SetParent(transform);
                quad.gameObject.name = $"quad{row}x{column}";
                var block = quad.AddComponent <Block>();
                block.OnBlockPressed   += PlayerMoveBlockInput;
                block.OnFinishedMoving += HandleBlockFinishedMoving;

                block.Init(new Vector2Int(row, column), imageSlices[row, column]);
                _blocks[row, column] = block;
            }
        }
        _emptyBlock = _blocks[blocksPerLine - 1, blocksPerLine - 1];
    }
Beispiel #4
0
    void CreatePuzzle()
    {
        Texture2D[,] imageSlices = ImageSlicer.GetSlices(image, blocksPerLine);
        for (int y = 0; y < blocksPerLine; y++)
        {
            for (int x = 0; x < blocksPerLine; x++)
            {
                GameObject blockObject = GameObject.CreatePrimitive(PrimitiveType.Cube);

                blockObject.transform.position = new Vector2(x + 6, y + 1);//-Vector2.one * (blocksPerLine - 1) * .5f + new Vector2(x, y);
                blockObject.transform.parent   = transform;

                Block block = blockObject.AddComponent <Block>();

                block.OnBlockPressed += PlayerMoveBlockInput;
                block.Init(new Vector2Int(x, y), imageSlices[x, y]);

                if (y == 0 && x == blocksPerLine - 1)
                {
                    blockObject.SetActive(false);
                    emptyBlock = block;
                }
            }
        }

        //Camera.main.orthographicSize = blocksPerLine * .55f;
    }
Beispiel #5
0
    void CreatePuzzle()
    {
        blocks = new BlockEvent[blocksPerLine, blocksPerLine];
        Texture2D[,] imageSlices = ImageSlicer.GetSlices(image, blocksPerLine);
        for (int i = 0; i < blocksPerLine; i++)
        {
            for (int j = 0; j < blocksPerLine; j++)
            {
                GameObject blockObject = GameObject.CreatePrimitive(PrimitiveType.Quad);
                blockObject.transform.position = -Vector2.one * (blocksPerLine - 1) * 0.5f + new Vector2(j, i) + new Vector2(transform.position.x, transform.position.y);
                blockObject.transform.position = new Vector3(blockObject.transform.position.x, blockObject.transform.position.y, transform.position.z - 0.1f);
                blockObject.transform.parent   = transform;

                BlockEvent block = blockObject.AddComponent <BlockEvent>();
                block.OnBlockPressed   += PlayerMouseBlockInput;
                block.OnFinishedMoving += OnBlockFinishedMoving;
                block.Init(new Vector2Int(j, i), imageSlices[j, i]);
                blocks[j, i] = block;

                if (i == 0 && j == blocksPerLine - 1)
                {
                    emptyBlock = block;
                }
            }
        }
        cam.orthographicSize = blocksPerLine * 0.55f;
        inputs = new Queue <BlockEvent>();
    }
Beispiel #6
0
        public void CreatePuzzle()
        {
            blocks = new Block[blocksPerLine, blocksPerLine];
            Texture2D[,] imageSlices = ImageSlicer.GetSlices(image, blocksPerLine);

            for (int y = 0; y < blocksPerLine; y++)
            {
                for (int x = 0; x < blocksPerLine; x++)
                {
                    GameObject blockObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
                    blockObject.transform.position = -Vector3.one * (blocksPerLine - 1) * .5f + new Vector3(x, y, 0);
                    blockObject.transform.parent   = transform;

                    Block block = blockObject.AddComponent <Block>();
                    block.OnBlockPressed   += PlayerMoveBlockInput;
                    block.OnFinishedMoving += OnBlockFinishedMoving;
                    block.Init(new Vector3Int(x, y, 0), imageSlices[blocksPerLine - x - 1, blocksPerLine - y - 1]);
                    blocks[x, y] = block;

                    if (y == 0 && x == blocksPerLine - 1)
                    {
                        emptyBlock = block;
                    }
                }
            }

            Camera.main.transform.position = new Vector3(0, 1, -blocksPerLine * 2f);
            inputs = new Queue <Block>();
        }
Beispiel #7
0
    public List <Texture2D> GetSpritesFromTexture_3D(Character _character, int blocks)
    {
        Texture2D        temp     = null;
        List <Texture2D> tempList = new List <Texture2D>();

        Texture2D[,] imageSlices = new Texture2D[blocks, blocks];
        if (_characterSpriteDictionary.TryGetValue(_character, out temp))
        {
            imageSlices = ImageSlicer.GetSlices(temp, blocks);
        }

        if (temp != null)
        {
            for (int y = 0; y < blocks; y++)
            {
                for (int x = 0; x < blocks; x++)
                {
                    tempList.Add(imageSlices[x, y]);
                }
            }

            return(tempList);
        }

        print("Error In Color Manager - GetColorValue Method");
        return(null);
    }
Beispiel #8
0
    void CreatePuzzle()
    {
        blocks = new Block[blocksPerLine, blocksPerColumn];   // création de la liste des blocs
        Texture2D[,] imageSlices = ImageSlicer.GetSlices(brailleWord, blocksPerLine);
        //Vector3Int [,] MatriceLettre= transformationMatrice(mot_a_coder);
        //Texture2D [,] ImageLettre = transformationImage(mot_a_coder);


        for (int y = 0; y < blocksPerColumn; y++)
        {
            for (int x = 0; x < blocksPerLine; x++)
            {
                GameObject blockObject = GameObject.CreatePrimitive(PrimitiveType.Quad);                                                                                                            // récupération d'un bloc = Quad
                blockObject.transform.position = new Vector2(-Vector2.one.x * (blocksPerLine - 1) * .5f + new Vector2(x, y).x, -Vector2.one.y * (blocksPerColumn - 1) * .5f + new Vector2(x, y).y); // on s'arrange pour que ça soit symétrique par rapport à la caméra
                blockObject.transform.parent   = transform;

                Block block = blockObject.AddComponent <Block>();
                block.OnBlockPressed   += PlayerMoveBlockInput;
                block.OnFinishedMoving += OnBlockFinishedMoving;
                block.Init(new Vector2Int(x, y), imageSlices[x, y]);
                //block.Init(new Vector2Int(x, y), ImageLettre[x,y], MatriceLettre[x, y]); //on donne l'image (une partie découpée de l'image d'origine) au bloc
                blocks[x, y] = block;

                blockObject.tag = letterAndPos(x, y);

                if (y == blocksPerColumn - 1 && x == blocksPerLine - 1)
                {
                    blockObject.SetActive(false); // on enlève l'image du bloc en bas à droite
                    emptyBlock = block;
                }
            }
        }

        for (int i = 0; i < nombrePermutation; i++)   // on réalise nombrePermutation permutations entre deux blocs pour mélanger le puzzle
        {
            int a = Random.Range(0, blocksPerLine);   //
            int b = Random.Range(0, blocksPerColumn); // x

            int c = Random.Range(0, blocksPerLine);
            int d = Random.Range(0, blocksPerColumn);

            Vector2Int targetCoord = blocks[a, b].coord;
            blocks[a, b].coord = blocks[c, d].coord;
            blocks[c, d].coord = targetCoord;

            Vector2 targetPosition = blocks[a, b].transform.position;
            blocks[a, b].transform.position = blocks[c, d].transform.position;
            blocks[c, d].transform.position = targetPosition;

            //Vector3 targetMatriceLettre = blocks[a,b].lettre;
            //blocks[a, b].lettre = blocks[c, d].lettre;
            //blocks[c, d].lettre = targetMatriceLettre;
        }


        Camera.main.orthographicSize = Mathf.Max(blocksPerLine, blocksPerColumn) * .55f; //modification de l'image pour que ça correponde à l'écran
        inputs = new Queue <Block>();
        state  = PuzzleState.InPlay;
    }
Beispiel #9
0
    void CreatePuzzle()
    {
        blocks = new Block[blocksPerLine, blocksPerColumn];   // creation blocklist
        Texture2D[,] imageSlices = ImageSlicer.GetSlices(brailleWord, blocksPerLine);
        for (int y = 0; y < blocksPerColumn; y++)
        {
            for (int x = 0; x < blocksPerLine; x++)
            {
                GameObject blockObject = GameObject.CreatePrimitive(PrimitiveType.Quad);                                                                                                            // create block = Quad
                blockObject.transform.position = new Vector2(-Vector2.one.x * (blocksPerLine - 1) * .5f + new Vector2(x, y).x, -Vector2.one.y * (blocksPerColumn - 1) * .5f + new Vector2(x, y).y); // symetrical to camera
                blockObject.transform.parent   = transform;

                Block block = blockObject.AddComponent <Block>();
                block.OnBlockPressed   += PlayerMoveBlockInput;
                block.OnFinishedMoving += OnBlockFinishedMoving;
                block.Init(new Vector2Int(x, y), imageSlices[x, y]);
                blocks[x, y] = block;

                blockObject.tag = letterAndPos(x, y); // apply a tag for each kind of letter and if it's top or bottom part

                if (y == blocksPerColumn - 1 && x == blocksPerLine - 1)
                {
                    blockObject.SetActive(false); // disable block bottom right
                    emptyBlock = block;
                }
            }
        }

        for (int i = 0; i < nombrePermutation; i++)   //shuffling
        {
            int a = Random.Range(0, blocksPerLine);   // y
            int b = Random.Range(0, blocksPerColumn); // x

            int c = Random.Range(0, blocksPerLine);
            int d = Random.Range(0, blocksPerColumn);

            Vector2Int targetCoord = blocks[a, b].coord;
            blocks[a, b].coord = blocks[c, d].coord;
            blocks[c, d].coord = targetCoord;

            Vector2 targetPosition = blocks[a, b].transform.position;
            blocks[a, b].transform.position = blocks[c, d].transform.position;
            blocks[c, d].transform.position = targetPosition;
        }


        Camera.main.orthographicSize = Mathf.Max(blocksPerLine, blocksPerColumn) * .55f; // adapt camera to game
        inputs = new Queue <Block>();
        state  = PuzzleState.InPlay;
    }
Beispiel #10
0
    void CreatePuzzle()
    {
        id     = (blocksPerLine * blocksPerLine) - (blocksPerLine - 1);
        blocks = new Block[blocksPerLine, blocksPerLine];
        Texture2D[,] imageSlices = ImageSlicer.GetSlices(image, blocksPerLine);
        solver.initialPos        = new Vector2Int[(blocksPerLine * blocksPerLine)];
        solver.currentPos        = new Vector2Int[(blocksPerLine * blocksPerLine)];
        solver.idOrder           = new int[(blocksPerLine * blocksPerLine)];
        solver.correctidOrder    = new int[(blocksPerLine * blocksPerLine)];

        for (int y = 0; y < blocksPerLine; y++)
        {
            for (int x = 0; x < blocksPerLine; x++)
            {
                blockObject = GameObject.CreatePrimitive(PrimitiveType.Quad);
                blockObject.transform.position = -Vector2.one * (blocksPerLine - 1) * .5f + new Vector2(x, y);
                blockObject.transform.parent   = transform;

                block = blockObject.AddComponent <Block>();
                block.OnBlockPressed   += PlayerMoveBlockInput;
                block.OnFinishedMoving += OnBlockFinishedMoving;
                block.Init(new Vector2Int(x, y), imageSlices[x, y]);
                block.id     = id;
                blocks[x, y] = block;
                if (isDivisible(id, blocksPerLine))
                {
                    id = id - (blocksPerLine * 2);
                }
                id++;

                if (y == 0 && x == blocksPerLine - 1)
                {
                    emptyBlock = block;
                    block.id   = 0;
                }
                solver.initialPos[block.id]     = block.coord;
                solver.currentPos[block.id]     = block.coord;
                solver.idOrder[block.id]        = block.id;
                solver.correctidOrder[block.id] = block.id;
            }
        }

        Camera.main.orthographicSize = blocksPerLine * .55f;
        inputs = new Queue <Block>();
    }
Beispiel #11
0
    public List <Sprite> GetSpritesFromTexture(Character _character)
    {
        Texture2D        temp     = null;
        List <Texture2D> tempList = new List <Texture2D>();

        Texture2D[,] imageSlices = new Texture2D[3, 3];
        List <Sprite> tempSprites = new List <Sprite>();

        if (_characterSpriteDictionary.TryGetValue(_character, out temp))
        {
            imageSlices = ImageSlicer.GetSlices(temp, 3);
        }

        if (temp != null)
        {
            for (int y = 0; y < 3; y++)
            {
                for (int x = 0; x < 3; x++)
                {
                    tempList.Add(imageSlices[x, y]);
                }
            }

            int size = 2;

            for (int i = 0; i < tempList.Count; i++)
            {
                tempList[i].Resize(size, size);
                tempList[i].Apply();
            }

            for (int i = 0; i < tempList.Count; i++)
            {
                Rect rec = new Rect(0, 0, size, size);
                print("Width and Height: " + tempList[i].width + " - " + tempList[i].height);
                tempSprites.Add(Sprite.Create(tempList[i], rec, new Vector2(0, 0), 1));
            }

            return(tempSprites);
        }

        print("Error In Color Manager - GetColorValue Method");
        return(null);
    }
    void CreatePuzzle()
    {
        float a = 0f;
        float b = 0f;

        blocks = new Block[blocksPerLine, blocksPerLine];
        Texture2D[,] imageSlices = ImageSlicer.GetSlices(image, blocksPerLine);
        for (int y = 0; y < blocksPerLine; y++)
        {
            for (int x = 0; x < blocksPerLine; x++)
            {
                GameObject blockObject = GameObject.CreatePrimitive(PrimitiveType.Quad);
                blockObject.transform.position    = -Vector2.one * (blocksPerLine - 1) * .5f + new Vector2(2.5f + x + a, -2.5f + y + b);
                blockObject.transform.localScale += new Vector3(0.5f, 0.5f, 0.5f);
                blockObject.transform.parent      = transform;

                Block block = blockObject.AddComponent <Block>();
                block.OnBlockPressed   += PlayerMoveBlockInput;
                block.OnFinishedMoving += OnBlockFinishedMoving;
                block.Init(new Vector2Int(x, y), imageSlices[x, y]);
                blocks[x, y] = block;
                block.BeUnActive();

                if (y == 0 && x == blocksPerLine - 1)
                {
                    emptyBlock = block;
                }

                a += 0.5f;
            }

            a  = 0f;
            b += 0.4f;
        }


        inputs = new Queue <Block>();

        StartShuffle();
    }
Beispiel #13
0
    void CreatePuzzle()
    {
        blocks = new Block[blocksPerLine, blocksPerLine];
        //                                                  imgae
        // Create a copy of the texture by reading and applying the raw texture data.
        Texture2D texCopy = new Texture2D(image.width, image.height, image.format, image.mipmapCount > 1);

        texCopy.LoadRawTextureData(image.GetRawTextureData());
        //Debug.Log(texCopy.isReadable);
        texCopy.Apply();
        Texture2D[,] imageSlices = ImageSlicer.GetSlices(texCopy, blocksPerLine);


        for (int y = 0; y < blocksPerLine; y++)
        {
            for (int x = 0; x < blocksPerLine; x++)
            {
                GameObject blockObject = GameObject.CreatePrimitive(PrimitiveType.Quad);
                blockObject.transform.position = -Vector2.one * (blocksPerLine - 1) * .5f + new Vector2(x, y);
                blockObject.transform.parent   = transform;

                Block block = blockObject.AddComponent <Block>();
                block.OnBlockPressed   += PlayerMoveBlockInput;
                block.OnFinishedMoving += OnBlockFinishedMoving;
                block.Init(new Vector2Int(x, y), imageSlices[x, y]);
                blocks[x, y] = block;

                if (y == 0 && x == blocksPerLine - 1)
                {
                    emptyBlock = block;
                }
            }
        }

        Camera.main.orthographicSize = blocksPerLine; //* .55f;
        inputs = new Queue <Block>();
    }
Beispiel #14
0
    private void CreatePuzzle()
    {
        generateBoolArray();
        puzzleBlocks        = new PuzzleBlock[blocksPerLine * blocksPerLine];
        Texture2D[,] images = ImageSlicer.GetSlices(image, blocksPerLine);
        int[] numbersInOrder = new int[blocksPerLine * blocksPerLine];
        for (int x = 0; x < blocksPerLine; x++)
        {
            for (int y = 0; y < blocksPerLine; y++)
            {
                GameObject blockObj   = GameObject.CreatePrimitive(PrimitiveType.Quad);
                int        pos        = randomPosition();
                int        blockObj_x = generateX(pos);
                int        blockObj_y = generateY(pos);

                blockObj.transform.position = -Vector2.one * (blocksPerLine - 1) * 0.5f + new Vector2(blockObj_x, blockObj_y);
                blockObj.transform.parent   = transform;

                PuzzleBlock puzzleBlock = blockObj.AddComponent <PuzzleBlock>();
                puzzleBlock.OnBlockPressed   += AddMoveBlockToQueue;
                puzzleBlock.OnFinishedMoving += OnFinishedMoving;
                int order = (blocksPerLine * blocksPerLine) - (blocksPerLine - (x + 1) + y * blocksPerLine);
                if (order == 9)
                {
                    numbersInOrder[pos] = -1;
                }
                else
                {
                    numbersInOrder[pos] = order;
                }
                puzzleBlock.Init(new Vector2Int(blockObj_x, blockObj_y), images[x, y], order);
                puzzleBlocks[blocksPerLine * x + y] = puzzleBlock;
                if (y == 0 && x == blocksPerLine - 1)
                {
                    blockObj.SetActive(false);
                    emptyBlock = puzzleBlock;
                }
            }
        }
        int[] numbersOrdered = new int[blocksPerLine * blocksPerLine];
        int   j = 0;

        for (int i = 6; i < 9; i++)
        {
            if (numbersInOrder[i] != -1)
            {
                numbersOrdered[j] = numbersInOrder[i];
                j++;
            }
        }
        for (int i = 3; i < 6; i++)
        {
            if (numbersInOrder[i] != -1)
            {
                numbersOrdered[j] = numbersInOrder[i];
                j++;
            }
        }

        for (int i = 0; i < 3; i++)
        {
            if (numbersInOrder[i] != -1)
            {
                numbersOrdered[j] = numbersInOrder[i];
                j++;
            }
        }
        int inversions = 0;

        for (int i = 0; i < numbersOrdered.Length - 1; i++)
        {
            for (int j1 = i + 1; j1 < numbersOrdered.Length - 1; j1++)
            {
                if (numbersOrdered[j1] > numbersOrdered[i])
                {
                    inversions++;
                }
            }
        }
        if (inversions % 2 == 1)
        {
            pab.restartPuzzleButton();
        }
        Camera.main.orthographicSize = blocksPerLine * 0.65f;
        blocksQueue = new Queue <PuzzleBlock>();
    }
Beispiel #15
0
    private void PickImage(int maxSize)
    {
        NativeGallery.Permission permission = NativeGallery.GetImageFromGallery((path) =>
        {
            Debug.Log("Image path: " + path);
            if (path != null)
            {
                // Create Texture from selected image

                Texture2D texture = NativeGallery.LoadImageAtPath(path, maxSize);

                /*
                 * Texture2D texCopy = new Texture2D(texture.width, texture.height, texture.format, texture.mipmapCount > 1);
                 * texCopy.LoadRawTextureData(texture.GetRawTextureData());
                 * texCopy.Apply();
                 *
                 * byte[] pix = texture.GetRawTextureData();
                 * Texture2D readableText = new Texture2D(texture.width, texture.height, texture.format, false);
                 * readableText.LoadRawTextureData(pix);
                 * readableText.Apply();
                 */

                RenderTexture renderTex = RenderTexture.GetTemporary(
                    texture.width,
                    texture.height,
                    0,
                    RenderTextureFormat.Default,
                    RenderTextureReadWrite.Linear);

                Graphics.Blit(texture, renderTex);
                RenderTexture previous  = RenderTexture.active;
                RenderTexture.active    = renderTex;
                Texture2D readableText2 = new Texture2D(texture.width, texture.height);
                readableText2.ReadPixels(new Rect(0, 0, renderTex.width, renderTex.height), 0, 0);
                readableText2.Apply();
                RenderTexture.active = previous;
                RenderTexture.ReleaseTemporary(renderTex);


                //if (texture == null)
                //{
                //    Debug.Log("Couldn't load texture from " + path);
                //    return;
                //}

                blocks = new Block[blocksPerLine, blocksPerLine];
                Texture2D[,] imageSlices = ImageSlicer.GetSlices(readableText2, blocksPerLine);
                for (int y = 0; y < blocksPerLine; y++)
                {
                    for (int x = 0; x < blocksPerLine; x++)
                    {
                        GameObject blockObject         = GameObject.CreatePrimitive(PrimitiveType.Quad);
                        blockObject.transform.position = -Vector2.one * (blocksPerLine - 1) * .5f + new Vector2(x, y);
                        blockObject.transform.parent   = transform;

                        Block block             = blockObject.AddComponent <Block>();
                        block.OnBlockPressed   += PlayerMoveBlockInput;
                        block.OnFinishedMoving += OnBlockFinishedMoving;
                        block.Init(new Vector2Int(x, y), imageSlices[x, y]);
                        blocks[x, y] = block;

                        if (y == 0 && x == blocksPerLine - 1)
                        {
                            emptyBlock = block;
                        }
                    }
                }

                Camera.main.orthographicSize = blocksPerLine;  //* .55f;
                inputs = new Queue <Block>();

                StartShuffle();

                /*
                 *         // Assign texture to a temporary quad and destroy it after 5 seconds
                 *         GameObject quad = GameObject.CreatePrimitive(PrimitiveType.Quad);
                 *          quad.transform.position = Camera.main.transform.position + Camera.main.transform.forward * 2.5f;
                 *         quad.transform.forward = Camera.main.transform.forward;
                 *         //1 2
                 *          quad.transform.localScale = new Vector3(1f, readableText2.height / (float)readableText2.width, 1f);
                 *
                 *          Material material = quad.GetComponent<Renderer>().material;
                 *          if (!material.shader.isSupported) // happens when Standard shader is not included in the build
                 *              material.shader = Shader.Find("Legacy Shaders/Diffuse");
                 *          //3
                 *          material.mainTexture = readableText2;
                 *
                 *
                 *         Destroy(quad, 5f);
                 *
                 *         // If a procedural texture is not destroyed manually,
                 *         // it will only be freed after a scene change
                 *         //4
                 *          Destroy(readableText2, 5f);
                 **/
            }
        }, "Select a PNG image", "image/png", maxSize);



        Debug.Log("Permission result: " + permission);
    }