Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity Firebase emulator suite: FirestoreSettings: Changing it at runtime crashes Unity #719

Open
DavidZobrist opened this issue Jun 25, 2020 · 23 comments

Comments

@DavidZobrist
Copy link

DavidZobrist commented Jun 25, 2020

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

@DavidZobrist DavidZobrist added the new New issue. label Jun 25, 2020
@google-oss-bot
Copy link

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@a-maurice
Copy link
Contributor

Hi @DavidZobrist

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

@Glongooo
Copy link

Hello, @a-maurice, have same needs, is there any news on emulator support?

@distastee
Copy link

distastee commented Feb 10, 2021

1 - Any plans or news here? @a-maurice @chkuang-g

@raqso
Copy link

raqso commented Mar 3, 2021

👍 @a-maurice @chkuang-g It would be very useful.

@artoonie
Copy link

artoonie commented May 3, 2021

@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

@sevdanski
Copy link

@a-maurice is there any progress on this?
I noticed that the unity functions api has a method to configure the emulator, but none of the other services appear to have the same setting?
All my attempts to manually set the settings for auth and database have failed.

@dconeybe dconeybe self-assigned this Oct 8, 2021
@dconeybe
Copy link

dconeybe commented Oct 8, 2021

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;

@sevdanski
Copy link

@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.

@dconeybe
Copy link

@sevdanski I'm glad to hear that you got the Firestore emulator working with your Unity app. We have plans to add a convenience useEmulator() method for Firestore but no specific timelines for getting that added (Googlers see b/202462877). In the meantime, to use the Firestore emulator simply use the steps from #719 (comment).

Since the issue with the Firestore emulator is resolved, I'm going to remove the Firestore label from this ticket. And since my personal expertise is in Firestore (not Firebase in general) I'm going to leave this discussion and let the other team members response to the questions about the other emulators.

@dconeybe dconeybe removed their assignment Oct 12, 2021
@DellaBitta
Copy link
Contributor

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!

@sevdanski
Copy link

@DellaBitta @dconeybe Thanks to you both for the info. I'll keep an eye out for the updates!

@artoonie
Copy link

#719 (comment) worked for me. Note that for those using separate assembly references for their tests and runtime code, FirebaseFirestore.DefaultInstance will exist twice: once in each process. Make sure you handle that. In my case, I have the code above run in two places: once in my testing code, and once in my game code.

@pedro15
Copy link

pedro15 commented Apr 28, 2022

Any news on this?

@mrchantey
Copy link

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.

@StefanoCos
Copy link

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

@pedro15
Copy link

pedro15 commented May 24, 2023

We need a firebase update to support emulator throug Unity ASAP! is a must for testing

@cadcri
Copy link

cadcri commented Oct 7, 2023

We need it !!!

@ronald112
Copy link

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

@otri
Copy link

otri commented Nov 29, 2023

Holy cowza, how many people are blocked like we are, just because of a lack of resources at Firebase on Unity? I would love some more transparency about what's working vs not working. I hate wasting time hunting down what major pieces are not working. Emulator suite is pretty darn important to get running inside a unit testing workflow. Us Unity developers need it.

@pedro15
Copy link

pedro15 commented Dec 24, 2023

PLEASE ADD IT

@Awais6
Copy link

Awais6 commented May 16, 2024

Is there any Update?

@Antonio-Gorisek
Copy link

Any updates about this?
Has anyone managed to find a non-standard way to address this issue, or discovered an alternative solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests