VeriorPies / ParrelSync

(Unity3D) Test multiplayer without building
MIT License
4.47k stars 314 forks source link

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

Open Awais6 opened 1 year ago

Awais6 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

somedeveloper00 commented 9 months ago

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 commented 8 months ago

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

cesmoak commented 3 months ago

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);