How to take a image from firebase storage ?
public Image Photo;
public void PhotoTaker()
{
Firebase.Storage.FirebaseStorage storage = Firebase.Storage.FirebaseStorage.DefaultInstance;
Firebase.Storage.StorageReference storage_ref = storage.GetReferenceFromUrl(Removed for question);
const long MaxAllowedSize = 10000000; //In Bytes | 1000000 Bytes is 1MB
storage_ref.GetBytesAsync(MaxAllowedSize).ContinueWith((Task<byte[]> task) =>
{
if (!task.IsFaulted || !task.IsCanceled)
{
Sprite sprite;
Texture2D texture = new Texture2D(1, 1, TextureFormat.ARGB32, false);
byte[] Contents = task.Result;
texture.LoadImage(Contents);
sprite = Sprite.Create(texture, new Rect(0, 0 , texture.width, texture.height), new Vector2(0f, 0f));
Photo.sprite = sprite;
}
});
}
Why doesn't this work ?
Comment
Your answer
Follow this Question
Related Questions
Unity Pay Cloud Storage Transaction Failure 0 Answers
[Multiple-Choice Quiz Game] How to change the text quiz answer in the button into image? 0 Answers
How to Move an Image to an other Panel 1 Answer
Import Image then get all Pixels 0 Answers
How do you put an image on the screen and keep it there? 0 Answers