(Unity) How to test Firebase multiplayer build and editor at the same time? [closed]

夙愿已清 提交于 2020-11-29 21:07:39

问题


I'm getting really frustrated with @Frank-van-Puffelen who closed my questions just because they don't contain minimum reproducible code. This is a valid question and there are useful answers out there. I made a duplicate question because I felt my first (this one) was closed unfairly and is not getting reopened. Now I cannot delete my second nor this one because Frank-van-Puffelen answered and then closed it. Frank, if you don't understand, then let someone else answer or ask for more information. Don't just immediately close this. I need mod assistance.

My Firebase app works in the editor, and it works in build, but when I try to run both at the same time, the second instance crashes once the first Firebase command is invoked (firestore snapshot).

I suspect that I may need to create a firebase instance with a different name, but I'm not sure how. Right now the two instances both use Firebase.DefaultInstance.

The crash gives no errors, and the editor logs show everything runs fine until

Query q = db.Collection("matches").OrderByDescending("players");
QuerySnapshot snapSht = await q.GetSnapshotAsync();

How do I run a second Unity-Firebase instance on a single local machine for multiplayer testing?

Steps to reproduce problem:

  1. Install and set up firebase in Unity per the documentation
  2. Initialize the app and fetch a snapshot from Firestore
  3. Build and run the app
  4. While build is running, press play in Unity Editor. Once the snapshot code runs, Unity will crash. If Editor is run first, the build will be the one to crash

来源:https://stackoverflow.com/questions/64934421/unity-how-to-test-firebase-multiplayer-build-and-editor-at-the-same-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!