public IEnumerator CheckForceSafetyChecksWorks() { BurstCompiler.Options.ForceEnableBurstSafetyChecks = true; yield return(null); var job = new DisabledSafetyChecksJob() { WasHit = new NativeArray <int>(1, Allocator.TempJob) }; job.Schedule().Complete(); try { // Even though the job has set disabled safety checks, the menu item 'Force On' // has been set which overrides any other requested behaviour. Assert.AreEqual(1, job.WasHit[0]); } finally { job.WasHit.Dispose(); } }
public IEnumerator CheckSafetyChecksOnGloballyAndOffInJob() { BurstCompiler.Options.EnableBurstSafetyChecks = true; BurstCompiler.Options.ForceEnableBurstSafetyChecks = false; yield return(null); var job = new DisabledSafetyChecksJob() { WasHit = new NativeArray <int>(1, Allocator.TempJob) }; job.Schedule().Complete(); try { // Safety checks are on globally but off in job. Assert.AreEqual(0, job.WasHit[0]); } finally { job.WasHit.Dispose(); } }