docs.unity3d.com
    Show / Hide Table of Contents

    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.

    In This Article
    • OnUpdate()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023