MoralisWeb3/unity-web3-game-kit

WalletConnect has been destroyed

btcgames opened this issue · 3 comments

MissingReferenceException: The object of type 'WalletConnect' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.MonoBehaviour.StartCoroutine (System.Collections.IEnumerator routine) (at :0)
WalletConnectSharp.Unity.WalletConnect+d__54.MoveNext () (at Packages/io.moralis.web3-unity-sdk/Runtime/External/WalletConnect/WalletConnectSharp.Unity/WalletConnect.cs:241)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () (at <695d1cc93cca45069c528c15c9fdd749>:0)
MoralisUnity.Kits.AuthenticationKit.AuthenticationKit+<WalletConnect_Connect>d__19.MoveNext () (at Packages/io.moralis.web3-unity-sdk/Runtime/Kits/AuthenticationKit/Scripts/AuthenticationKit.cs:308)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__6_0 (System.Object state) (at <695d1cc93cca45069c528c15c9fdd749>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at :0)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()

This usually happens due to an error, usually some link between wallet connect and AuthorizationKit or sub objects.

This usually happens due to an error, usually some link between wallet connect and AuthorizationKit or sub objects.

I have authorization on the first scene. When I move to another scene and then back to the first one, then a new session is created for me and I reconnect to the wallet
How do I save a session between scenes?

Maybe it's related to the script WalletConnect. Comparison of the old and new versions of the sdk
1
2

Solved