Open FrenziedAI opened 1 week ago
This code snippet
Debug.Log("LoadThuman " + bornPoint.ToString() + Button_Test.ToString() + this.ToString() + obj.ToString() + newAvatarData.ToString() + Instance.ToString() + UIMgr.Instance.ToString() + CommonData.m_Player.ToString());
Where: bornPoint and Button_Test are GameObject references of this on the Inspector, obj is retrieved via GameObject.Find("bornPoint");, newAvatarData is an instance that is created before the await statement in a task, Instance refers to a static object of this, UIMgr.Instance and CommonData.m_Player are static instances of other objects.
Under normal conditions (when iOS is not paused), the output is
LoadThumanbornPoint (UnityEngine.Transform)Button_Test (UnityEngine.UI.Button)UIWardrobe (Tsl.Ymkj.Partner.UIWardrobe)bornPoint (UnityEngine.GameObject)THumanAvatarVoUIWardrobe
.
However, under circumstances when iOS is paused, there is a probability that the output will be
LoadThumannullnullnullbornPoint (UnityEngine.GameObject)THumanAvatarVoUIWardrobe (Tsl.Ymkj.Partner.UIWardrobe)UIMgr (Tsl.Ymkj.Partner.UIMgr).
I have not yet pinpointed the exact moment where this gets lost.
UniTask Test4 UIWardrobe (Tsl.Ymkj.Partner.UIWardrobe)UniTask Test4 UIWardrobe (Tsl.Ymkj.Partner.UIWardrobe) UniTask Test5 null
UniTask Test4 UIWardrobe (Tsl.Ymkj.Partner.UIWardrobe) Tsl.Ymkj.Partner.THumanManager:DownLoadAssetBundle(String, String, UIWardrobe) Tsl.Ymkj.Partner.<LoadAsync>d__54:MoveNext() Cysharp.Threading.Tasks.CompilerServices.AsyncUniTaskMethodBuilder
1:Start(1:SetResult() Tsl.Ymkj.Partner.<UpdateWardrobeDataAll>d__7:MoveNext() Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask
1:Run()
Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask1:SetResult() Tsl.Ymkj.Partner.<UpdateWardrobeData>d__10:MoveNext() Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask
1:Run()
System.Diagnostics.StackTrace:init_frames(Int32, Boolean)
UnityEngine.StackTraceUtility:ExtractStackTrace()
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
System.Runtime.CompilerServices.MoveNextRunner:Run()
Cysharp.Threading.Tasks.UniTaskCompletionSourceCore1:TrySetResult(TResult) Cysharp.Threading.Tasks.UniTaskCompletionSourceCore
1:TrySetResult(TResult)
Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1:TrySetResult(TResult)
After the line
await unityWebRequest.SendWebRequest();
the references within the task (TSK) seem to be lost.
When calling unityFramework?.pause(true) to pause Unity from iOS and then calling unityFramework?.pause(false) to resume it, if there are UniTask code snippets that are currently executing, they may throw null pointer exceptions after resuming, while not pausing Unity does not cause this issue.