概要
System::InvalidOperationException: The UNKNOWN_OBJECT_TYPE has been declared as [WriteOnly] in the job, but you are reading from it. This Exception was thrown from a job compiled with Burst, which has limited exception support.
Job System を使用している Unity プロジェクトで
上記の例外が発生する現象に遭遇した
using var list = new NativeList<double>( Allocator.Temp ); foreach ( var x in list ) { }
NativeList に対して foreach を使用している箇所を
using var list = new NativeList<double>( Allocator.Temp ); for ( var i = 0; i < list.Length; i++ ) { }
for に置き換えたら例外が発生しなくなった