The Identity Providers section requires providing the bundle id or client credentials for each identity provider. Please see attached screenshot for a sample.
The problem is that I use different bundle ids/package names for my development and production builds. What this means is that once I have set up my identity providers to use the details from my development builds, they won’t work for prod builds. This defeats the purpose of environments because I have to create a different UGS project to be able to set my production app details in Identity Providers.
Why is it such that identity providers don’t have an environment setting? What then is the recommended workflow in my case - a different UGS project each for development and production builds?
How is that tied in with authentication?
What would you gain from that? You’d have to go through the sign up process for every environment only to allow for having separate credentials. Which you can achieve in some ways already, eg by using a “someone.dev” vs “someone.prod” username login for instance.
But the authentication credentials simply have no “state” that needs to be bound to a specific environment. You are very likely to log in to dev and prod with the same credentials anyway because the above doesn’t make any sense specifically because there are environments separating each credentials’ data so that you can use the same login for dev and prod.
The main point of environments is to separate any stored cloud data. So if I log in with my username/password it’s only the environment that determines whether my Cloud Save progress data is tied to a dev or prod environment and I can switch between these two by signing out, and signing back in with a different environment. I don’t have to have separate accounts for that, which would only make for a more convoluted workflow with potential mishaps like signing in to dev account but being in the prod environment.
Thank you. I use different bundle id / package name for my test and prod builds because I want testers to have both apps on their phone. Think of it as beta and prod apps. Installing a beta build should not overwrite their prod installation. It’s just neater and easier that way for testers. There are other reasons why I prefer separate installations too. I’ll have 50+ beta testers and it’s just easier to keep things separate.
I can only specify one bundle id for Apple Game Center identity provider, one client credentials for Google Play Games. But I have separate beta and prod builds. Do you see what I mean?
They are separate apps. So you have to sign in only once versus the scenario you explained where beta testers would have to be signing in and out to switch environments. For example, imagine receiving a prod push notification while you’re signed in to the test environment.
In this case it just seems like I need to have separate projects for beta and prod?
Got it, makes sense!
Starting to, I think.
My initial thought right now is that you don’t but you may have to swap out either the project ID (link with Unity cloud) or the bundle identifier of the app, or both. You can do so with a custom build step:
https://docs.unity3d.com/Manual/BuildPlayerPipeline.html
Changing the bundle identifier should be part of the build environment or player settings. Assigning a different cloud project ID may be trickier, quite frequently Unity doesn’t (yet) provide public editor APIs for that kind of thing. But typically it’s only one C# reflection invoke on an internal property or method away.
Oh I see. Thanks a lot for the information.
Hi, I have the same requirement for authentication. Our studio tests everything using our own Firebase and App Store Connect, but then we provide Android and Xcode projects that are handled by our client (We still manage UGS). I have identified how to update the cloud project ID during editor runtime (This does not permanently update the project id). Please use at your own risk, this was not fully tested:
public static class Startup
{
private static readonly Type PlayerSettingsType =
typeof(PlayerSettings);
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
static void OnBeforeSplashScreen()
{
SetCloudProjectId("8478d3cd-a7a1-4223-b979-be72811ef2a3");
}
private static void SetCloudProjectId(string projectId)
{
var internalSetCloudProjectId = PlayerSettingsType.GetMethod(
"SetCloudProjectId",
BindingFlags.NonPublic | BindingFlags.Static);
if (internalSetCloudProjectId == null)
{
Debug.LogWarning("Cannot write cloud project id");
return;
}
internalSetCloudProjectId.Invoke(
null, new object[] { projectId });
}
}