Best way to manage logging user back in after disconnecting

Hi,

Using authenticationKit in unity I’m carrying it through my scenes using the DontDestroy method.

I’m finding that when I disconnect it (which takes me back to the login scene) it’s unable to present the QR code since it’s been destroyed.

I would love to hear if I’m approaching this the best way, that is how to handle users disconnecting or becoming disconnected unintentionally.

I’m happy to send back to the login scene, it’s more how I reset authenticationKit.

Thanks for any advice here

Snape

Had the same problem, the 1.2.4 fix isnt fully right, I fixed it by myself, Moralis should add this into the SDK:

protected override async void Awake()
        {
            if (_instance == null || ReferenceEquals(this, _instance))
            {
                // Object.DontDestroyOnLoad only works for root GameObjects or components on root GameObject.
                // So let's set the parent to null.
                gameObject.transform.SetParent(null);
                _instance = this;
                DontDestroyOnLoad(gameObject);
            }
            else if (_instance != this)
           {
                //Instance is not the same as the one we have, destroy old one, and reset to newest one**
               Destroy(_instance.gameObject);
                _instance = this;
              DontDestroyOnLoad(gameObject);
           }
            else
            {
                Destroy(this);
            }

The “else if” part is what I changed. Without this change the authenticationkit loses reference to walletconnect.

Cheers

Thanks @Ether I’ll give this a try!

Could you please create an issue for this?