2

My old project gave me this error after I change my system to apple m1 .

USE_AUTH_EMULATOR not set.

when I use "SignInWithEmailAndPasswordAsync" func, immediately I get "USE_AUTH_EMULATOR not set." message. why it can be?

using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; using Firebase.Auth; public class authManager : Singleton<authManager> { public FirebaseAuth auth; public DBmanager dbManager; public bool errorCheckSignIn, errorCheckSignUp; loginMain loginMainSc; private void Start() { auth = Firebase.Auth.FirebaseAuth.DefaultInstance; dbManager = DBmanager.Instance; errorCheckSignIn = false; errorCheckSignUp = false; } public void signIn(string email, string password) { auth.SignInWithEmailAndPasswordAsync(email, password).ContinueWith(task => { if (task.IsCanceled) { Debug.LogError("canceled!"); return; } if (task.IsFaulted) { Debug.LogError("faulted!"); errorCheckSignIn = true; return; } if (task.IsCompleted) { FirebaseUser currentUser = task.Result.User; dbManager.userData.userId = currentUser.UserId; dbManager.userData.email = email; Debug.Log("Giriş yapıldı."); //PhotonNetwork.ConnectUsingSettings(); SceneManager.LoadScene("servers"); } }); } 

I tried to set environment variables, sent and unset Firebase Auth emulator for Mac. tried to put inside of my code;

 System.Environment.SetEnvironmentVariable("FIREBASE_AUTH_EMULATOR_HOST", "127.0.0.1:9099"); 

but I couldn't solve the problem.

2
  • I'm having the same error. Did you solve it? Commented Nov 10, 2023 at 0:18
  • 1
    I have same error any solution Commented Nov 10, 2023 at 11:45

4 Answers 4

3

That log message is no cause for alarm and can be disregarded unless you want to connect to the Firebase Auth Emulator.

The Firebase Unity SDK is built on top of the Firebase C++ SDK, which logs "USE_AUTH_EMULATOR not set" at the Info level. If USE_AUTH_EMULATOR is not set, the SDK logs that message to inform you that it is connecting to the live Firebase Auth service.

If USE_AUTH_EMULATOR is set with any other value, the SDK will connect to the Firebase Auth Emulator instead, based on the relevant configuration from the FIREBASE_AUTH_EMULATOR_HOST environment variable, falling back to localhost:9099 if that is also not present.

Sign up to request clarification or add additional context in comments.

Comments

0

Same question appears in my project, I use Windows and when I ran my project in Unity editor, this error occurred. But when I release it to an Android APK, everything is fine. So, I visit the document of firebase, and find that you can't run your project in editor with normal firebase SDK, you need a desktop workflow SDK. But I have not tried it yet, because our team don't use firebase any more. Hope this can help you.

firebase document with desktop workflow

Comments

0

In cmd line :

setx USE_AUTH_EMULATOR True 

Then restart both hub and unity project.


Fixed for me on windows with instructions from this article:

Cause:

You are trying to pass some configuration to Unity via environment variables. For example, you want Unity to use the proxy server configured by the HTTP_PROXY environment variable.

Resolution:

Follow the instructions below to set environment variables for your operating system.

Make sure to replace 'MY_VARIABLE_NAME' with the name of your environment variable (e.g. HTTP_PROXY) and replace 'my_variable_value' with the value you’d like to set.

Set environment variables on Windows

Via Windows settings:

  1. Open Start menu > search “Edit environment variables for your account”
  2. Under User variables, click New… > Fill in the Variable name and Variable value fields with the desired values.

Via command line:

  1. Open Start menu > Type “cmd” > open Command Prompt
  2. Type the following command and press enter:

setx MY_VARIABLE_NAME my_variable_value

Set environment variables on Mac

On Mac, applications such as Unity do not inherit environment variables from your settings like they do on Windows.

On Mac, the best way to pass environment variables to Unity is via a wrapper script. The wrapper script will first set the environment variables and then launch Unity Hub which will inherit the values you set.

  1. Open a Terminal window and enter the following script after replacing 'MY_VARIABLE_NAME' and 'my_variable_value' with the desired values and adjusting the Hub install path as needed:

echo '#!/bin/bash export MY_VARIABLE_NAME=my_variable_value export MY_OTHER_VARIABLE_NAME=my_other_variable_value nohup "/Applications/Unity Hub.app/Contents/MacOS/Unity Hub" &>/dev/null &' > launchUnityHub.command chmod +x launchUnityHub.command

  1. This creates the 'launchUnityHub.command' file, which you can move to a convenient location (e.g. the Desktop).
  2. Double-click the file to launch the Hub with the environment variables set, or invoke it from the terminal for the same effect. These environment variables will be passed on to any Unity Editor process launched from the Hub.

After setting environment variables

You will need to restart both your Unity Editor and the Unity Hub after setting environment variables.

Comments

0

try these methods before initializing:

Firebase.FirebaseApp.LogLevel = Firebase.LogLevel.Warning; 
System.Environment.SetEnvironmentVariable("FIREBASE_AUTH_EMULATOR_HOST", ""); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.