quickstart-unity: Unity + Firebase emulator suite: FirestoreSettings: Changing it at runtime crashes Unity

Hey 😃 We just set up the firebase emulator suite with success. Goal: We want to make our Unity project use that local instance.

We tried FirebaseFirestore db = FirebaseFirestore.DefaultInstance; db.Settings = db.Settings.WithHost("localhost:8080").WithSslEnabled(false).WithPersistenceEnabled(false);

But it crashes unity. Is there a way to set this yet in the Unity Firebase SDK?

Also creating a new FirebaseFirestoreSettings objects with the same values result in a crash when assigned to the current FirebaseFireStore.DefaultInstance.

Environment: Editor

Unity Version: 2019.3.11f1

Firebase SDK: 6.15.0

Used Packages: Analytics Crashlytics FireStore RemoteLinks Auth

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 6
  • Comments: 21 (2 by maintainers)

Most upvoted comments

Hi @DavidZobrist

Unfortunately the emulator suite is currently not supported on Unity, though it is on our radar. Sorry for the inconvenience.

though its on our roadmap.

Any chance we can get a peek at this roadmap? As developers we are making critical product decisions and knowing whether emulator support is around the corner or just a twinkle in googles eye would be incredibly helpful.

I am not able to reproduce this bug; that is, using the Firestore emulator from Unity Editor is working for me.

This bug was originally logged against a very old version of the SDK (6.15.0). Please try with the latest version (8.3.0).

Also, note that the API to edit the settings has changed. Here is the new way to setup the emulator:

FirebaseFirestore firestore = FirebaseFirestore.DefaultInstance;
firestore.Settings.Host = "localhost:8080";
firestore.Settings.SslEnabled = false;

@a-maurice can you please note on the docs that Unity is not supported? It is not clear: https://firebase.google.com/docs/emulator-suite

it’s been already 3 years since the first message was written, and still nothing…

Yeah it seems Unity firebase SDk is still not updated to fully support auth emulator, functions ( and maybe others?)

Any news on this?

Hi @sevdanski,

As of today we don’t have a Unity guide on how to use Firebase Emulators across all of our products, so that’s probably why your searches keep landing you here.

Additionally, we currently don’t officially support the use of emulators via the Unity SDK, though its on our roadmap. Our initial investigation made us aware of some runtime issues between Unity and varoius product emulators so the question of support isn’t simply one of documentation but of isolating, testing and fixing issues on a product per product basis, and then adding tests to our CI workflows.

When we do have official support you should expect proper documentation and a smoother experience than what you’re encountering today (sorry for the inconvenience). Additionally you should see an official update to this particular ticket – it won’t be a stealth release for sure!

@dconeybe I apologise, my previous message may have been a bit unclear. My enquiry was more about the Auth, Functions and the Realtime Database emulators - I wasn’t actually using Firestore at the time.

I have noticed that none of the unity tutorials appear to have set up instructions for any of these. All of the node based tutorials seemed to make use of a UseEmulator method which does not appear to be in most of the unity apis. (I did find that the FirestoreFunctions API has a method for setting it up with the emulator, and that is working)

The steps I have found online for the Database is to change the url in the google-services file, but that doesn’t appear to be working for me. Tracing out the database url in the settings always shows the default one.

I have found nothing on how to get it working with the Auth emulator at all - which I think I need to be able to have the auth properties appear in the functions emulator?

Aplogies if this was not the best place to ask these questions. I was repeatedly brought to this page for searches about how to get the emulators working in unity, and it seemed related, so I thought it was the best place to ask. If you could point me in the right direction regarding these issues, I would greatly appreciate it.

Also, for what it is worth, I was able to get Firestore working with the emulator using your above steps.