-
Notifications
You must be signed in to change notification settings - Fork 444
Description
[REQUIRED] Please fill in the following fields:
- Unity editor version: 2020.3.13f1
- Firebase Unity SDK version: 8.3.0 (also present on 8.1.0)
- Source you installed the SDK: .unitypackage
- Problematic Firebase Component: Firestore
- Other Firebase Components in use: Firestore
- Additional SDKs you are using: none
- Platform you are using the Unity editor on: Windows
- Platform you are targeting: Android, tested in Editor
- Scripting Runtime: Editor, scripting backend set to IL2CPP
[REQUIRED] Please describe the issue here:
On an otherwise empty scene I have one script that reads a document from Firestore. GetSnapshotAsync
always, 10/10 times throws an exception FirestoreException: Failed to get document from server.
UNLESS(!) before this read, I execute any write operation on the Firestore (or so it seems).
Once again, the read is ONLY successful if there is a write before it. This is really bizarre.
Also, the initial write always takes a very long time, from my tests it's always 20 seconds.
The strange thing is, earlier today everything was working perfectly. I started working on another project, came back to this one, and my app just stopped working. No changes in git today. I've tried restarting Unity, PC, installed newest SDK (8.3.0). Nothing helped.
Steps to reproduce:
- Run the following code.
- Exit play mode.
- Uncomment
TestWrite
call - Run the following code again.
This problem is so utterly bizarre that I wonder if this is somehow a problem with Firebase cache on my PC. How can I delete everything that Firebase/Firestore cached on my Windows machine?
I would like to see and attach more logs, however switching logging to Verbose does not seem to do anything in Editor.
Relevant Code:
public class TestScript : MonoBehaviour
{
async void Start()
{
//await TestWrite(); // The following Read works ONLY if this line is not commented out
await TestRead();
}
private async Task TestRead()
{
Debug.Log("Read starting");
DocumentReference doc = FirebaseFirestore.DefaultInstance.Document("test/test");
await doc.GetSnapshotAsync(Source.Server);
Debug.Log("Read finished");
}
private async Task TestWrite()
{
Debug.Log("Write starting");
var loginCounter = FirebaseFirestore.DefaultInstance.Document("test/test");
var data = new Dictionary<string, object>();
await loginCounter.SetAsync(data);
Debug.Log("Write finished");
}
}
This gives two possible results, depending if TestWrite
is commented out: