Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by frattapa · Mar 21, 2019 at 03:00 PM · databasegoogleasyncfilepath

Google Firebase and Unity (C#): Unable to download png from bucket

Specs

 Unity editor version:       2018.2.8f1
 Firebase Unity SDK version: 5.5.0
 Additional SDKs:            SimpleFirebaseUnity
 Developing on:              Mac
 Export Platform:            Android

Issue

I'm having troubles setting up a system to download pictures from storage. I'm not an expert in databases, but I wanted to give it try, just to learn how it is done. I found Firebase very useful to store metadata on the real-time database and easy to approach even for an entry level coder like me.

The problem is that I'm trying to download a .png file from a folder in storage, but I can't manage to find if the file is actually downloaded or if it's just lost in the process. I don't get any errors in the console, but when I open the folder in which the files should be, it's empty.

Thanks

Code

 private SimpleFirebaseUnity.Firebase firebaseDatabase;
 private FirebaseQueue firebaseQueue;
 private FirebaseStorage firebaseStorage;
 private StorageReference m_storage_ref;
 
 // Setup refernece to database and storage
 void SetupReferences()
 {
     // Get a reference to the database service, using SimpleFirebase plugin
     firebaseDatabase = SimpleFirebaseUnity.Firebase.CreateNew(FIREBASE_LINK, FIREBASE_SECRET);
 
     // Get a reference to the storage service, using the default Firebase App
     firebaseStorage = FirebaseStorage.DefaultInstance;
 
     // Create a storage reference from our storage service
     m_storage_ref = firebaseStorage.GetReferenceFromUrl(STORAGE_LINK);
 
     // Create a queue, using SimpleFirebase
     firebaseQueue = new FirebaseQueue(true, 3, 1f);
 }
 
 // ...
 
 IEnumerator DownloadImage(string address, string fileName)
 {
     var local_path = Application.persistentDataPath + THUMBNAILS_PATH;
     var content_ref = m_storage_ref.Child(THUMBNAILS_PATH + fileName + ".png");
 
     content_ref.GetFileAsync(local_path).ContinueWith(task => {
         if (!task.IsFaulted && !task.IsCanceled)
         {
             Debug.Log("File downloaded.");
         }
     });
 
     yield return null;
 }
 
Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image digitalmkt · Jan 06, 2020 at 11:05 AM 0
Share

Hey @frattapa . Did you solve that question? Thanks

avatar image mhayter · Jun 30, 2020 at 02:31 PM 0
Share

I seem to be having an identical problem - did you figure it out?

avatar image rohitvishwakarma1819 · Aug 24, 2020 at 07:12 AM 0
Share

Hi, did you find any way to fix the issue ? I also have a json file stored in firebase storage and I'm trying to download it. It works fine in unity editor but not in android. If you have any idea or solution regarding it please do let me know. Thanks

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

174 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Reading Google Sheets with Unity 0 Answers

,Call api and wait answer to return (async?) 1 Answer

Moving a file from the project folder to the data directory at runtime 1 Answer

Firebase for Unity using service accounts doesn't work 2 Answers

How do I set a query value from firestore to a text field? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges