Open mhadji05 opened 9 months ago
Hi @mhadji05 reach out on my discord and share an example of what you have so far. I'll try to help you troubleshoot what you have.
I'll also look into adding a sample scene as well.
Cheers
Just copy paste your code.
// Create a firebase authentication client
var firebaseClient = new FirebaseAuthenticationClient();
// Create a firebase storage client
var firebaseStorageClient = new FirebaseStorageClient(firebaseClient);
// Sign the user in
await firebaseClient.SignInWithEmailAndPasswordAsync(email, password);
// Get a reference to the resource using a path.
var resource = firebaseStorageClient.Resource("root/test.json");
var json = "{\"value\":\"42\"}";
string downloadUrl;
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(json)))
{
// Upload content to storage
downloadUrl = await resource.UploadAsync(stream, new Progress<FirebaseStorageProgress>(progress => Debug.Log(progress.Percentage)));
}
// Get content public download url (doesn't require authentication)
var knownUrl = await resource.GetDownloadUrlAsync();
Assert.IsTrue(downloadUrl == knownUrl);
// Download content
var httpClient = new HttpClient();
var response = await httpClient.GetAsync(knownUrl);
var responseData = await response.Content.ReadAsStringAsync();
Assert.IsTrue(responseData == json);
// Delete storage content
await resource.DeleteAsync();
If you upload an example scene I will appreciate it a lot.
Thanks
Dear friend,
I hope this message finds you well and 1st I want to thank you for the great work. I'm trying to use Firebase storage with REST on Unity but I failed. Can you please Add an example Scene with an example code showing how can upload a photo on Firebase, and how to retrieve it into the Unity image component how can you Get the Download Url?
I saw your Documentation on GitHub but when I add the code in a c# script in Unity there are a lot of errors, so I'm doing something wrong.
Thanks in advance!