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

[Feature Request] Make a way to sign in to different firebase accounts on clones #98

Open
Awais6 opened this issue Feb 16, 2023 · 5 comments

Comments

@Awais6
Copy link

Awais6 commented Feb 16, 2023

Describe the feature you'd like
I can't sign in to different firebase accounts, firebase is remembering the authentication when I sign in from the original editor and all clones are already signed in with that account, I can't change accounts on clones to test multiplayer

@arkms
Copy link

arkms commented Mar 28, 2023

At the start of the game do something like:
if(ClonesManager.IsClone())
UnityEditor.PlayerSettings.productName = "Your project name clone"

if the productName is different from the original, Unity will use different save data.

@Awais6
Copy link
Author

Awais6 commented Mar 29, 2023

Thanks @arkms,
I will try it soon & update the issue accordingly.

@somedeveloper00
Copy link

somedeveloper00 commented Oct 6, 2023

tried this method, FireBase still crashed. worth noting I have problem with the guest login feature.

using ParrelSync;
using UnityEditor;
using UnityEngine;

[DefaultExecutionOrder(-100)]
[DisallowMultipleComponent]
class EditorProductNameChanger : MonoBehaviour
{
    const string ProductNameFormat = "{0}{1}";
    static bool s_changed = false;

#if UNITY_EDITOR
    void Awake()
    {
        if (ClonesManager.IsClone() && !s_changed)
        {
            PlayerSettings.productName = string.Format(ProductNameFormat, PlayerSettings.productName, ClonesManager.GetArgument());
            Debug.LogFormat("<color=green>Changed product name to \"{0}\"</color>", PlayerSettings.productName);
        }
        s_changed = true;
        Destroy(this);
    }
#endif
}

@somedeveloper00
Copy link

I ended up building for Linux and using WSL with multiple users, each with one instance.

@cesmoak
Copy link

cesmoak commented Apr 10, 2024

We have solved this by changing the name passed in when creating or getting a firebase app instance:

#if UNITY_EDITOR
        private static string Name => ParrelSync.ClonesManager.IsClone() ? $"{FirebaseApp.DefaultName}_Clone" : FirebaseApp.DefaultName;
#else
        private static string Name => FirebaseApp.DefaultName;
#endif

        public static FirebaseApp App => FirebaseApp.GetInstance(Name) ?? FirebaseApp.Create(FirebaseApp.DefaultInstance.Options, Name);

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

No branches or pull requests

4 participants