//This is the callback function we created public void ImageLoaded() { //You can put anything in the callback function. You can either just grab the image, or tell your other scripts the custom image is available Debug.Log("The image has succesfully loaded!"); //image.sprite = AndroidGallery.Instance.GetSprite(); //if (image.sprite.rect.width != image.sprite.texture.width) //{ //Texture2D newText = new Texture2D((int)image.sprite.rect.width, (int)image.sprite.rect.height); //Color[] newColors = image.sprite.texture.GetPixels((int)image.sprite.textureRect.x, // (int)image.sprite.textureRect.y, // (int)image.sprite.textureRect.width, // (int)image.sprite.textureRect.height); //newText.SetPixels(newColors); //newText.Apply(); // return newText; //} //else // return sprite.texture; //Sprite newImage = AndroidGallery.Instance.GetSprite(); //frame.sprite = Sprite.Create(MyTexture, new Rect(0, 0, MyTexture.width, MyTexture.height), new Vector2(MyTexture.width / 2, MyTexture.height / 2)); Puzzle.PuzzleImages = new Texture[1]; //Puzzle.PuzzleImages[0] = AndroidGallery.Instance.GetTexture(); Puzzle.ResetGame(Puzzle.AddPuzzleImage(AndroidGallery.Instance.GetTexture())); }
private void NativeToolkit_OnImagePicked(Texture2D img, string path) { imagePath = path; //console.text += "\nImage picked at: " + imagePath; ST_PuzzleDisplay puzzle = FindObjectOfType <ST_PuzzleDisplay>(); puzzle.SetImage(img); puzzle.ResetGame(); Destroy(img); }