Diagnostic code · ARA0200
Non-deterministic simulation code
Code in a [Simulation] type or assembly depends on ambient state or scheduling. Identical inputs must produce identical fixed-tick results for prediction and replay. The edit is rejected; the last good code keeps running.
Common causes
- Reading wall-clock time, calling
Guid.NewGuid, usingSystem.Random, or accessing I/O. - Using
async,await, tasks, threads or timers in simulation code. - A lambda in a simulation command captures state.
Fixes
Use the supplied
Tickand its fixedDt, and the context RNG (ref Rngin a query), with authoritative state stored in ECS components or resources.Move I/O and asynchronous work outside simulation and pass their results through explicit inputs or commands.
Make command lambdas non-capturing and pass required values explicitly.
Code:
ARA0200Constant:
cs::NON_DETERMINISMReported by: Ara.Analyzers