The following assertion throws after the project crashes when playing on the device:
Assertion failed: Index < GetMaxIndex() [File:D:/P4Workspaces/Switch_3/Engine/Source/Runtime/Core/Public/Containers/SparseArray.h] [Line: 86]
his also occurs on Oculus Go although repro doesn't seem as consistent or reliable as the Quest
Sometimes this repros but references Line: 87 instead:
Assertion failed: !AllocationFlags[Index] [File:D:/P4Workspaces/Switch_2/Engine/Source/Runtime/Core/Public/Containers/SparseArray.h] [Line: 87]
解决方法1:此问题是因为使用了多线程后,线程调用的数组数据被提前回收所导致的错误,属于UE4引擎BUG,在4.23后解决了这个问题,所以更新到4.23后的版本即可解决错误;
解决方法2:因为数组被回收的原因,所以可以在蓝图中创建一个全局数组变量,多线程执行时防止函数重入即可;