I was using Firebase cloud functions in Unity2022.3.11 and got an error "USE_AUTH_EMULATOR not set." and froze.
What is this and what is needed to prevent the error from occurring?
Unitypackage has been installed. And written codes like that.
FirebaseFunctions func;
FirebaseAuth auth;
await FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
{
if(task.Result == DependencyStatus.Available)
{
auth = FirebaseAuth.DefaultInstance;
func = FirebaseFunctions.DefaultInstance;
}
else
{
Debug.Log(task.Result.ToString());
return;
}
});
try
{
if(auth.CurrentUser.UserId == null)
{
await auth.SignInAnonymouslyAsync();
}
else
{
Debug.Log($"Already auth {auth.CurrentUser.UserId}");
}
}
var task = func.GetHttpsCallable("task").CallAsync(idToken);
2
Answers
I found an answer.
But another error has happened.
What that means?
Are you sure that it is an error? 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 and connects to the live Firebase Auth service. If it has any other value, the Firebase Auth Emulator is connected instead, based on the relevant configuration (defaults tolocalhost:9099
at time of writing).That log message is no cause for alarm.
If your application has frozen, there is something else that is the cause.