Method OnUpdate
OnUpdate()
Implement OnUpdate()
to perform the major work of this system.
Declaration
protected abstract void OnUpdate()
Remarks
The system invokes OnUpdate()
once per frame on the main thread when any of this system's
EntityQueries match existing entities, the system has the [AlwaysUpdateSystem]
attribute, or the system has no queries at all. OnUpdate()
is triggered by the system's
parent system group, which calls the Update() method of all its child
systems in its own OnUpdate()
function. The Update()
function evaluates whether a system
should, in fact, update before calling OnUpdate()
.
The Entities.ForEach and Job.WithCode constructions provide convenient mechanisms for defining jobs. You can also instantiate and schedule an IJobChunk instance; you can use the [C# JobSystem] or you can perform work on the main thread. If you call EntityManager methods that perform structural changes on the main thread, be sure to arrange the system order to minimize the performance impact of the resulting sync points.