Class WorldDiffer | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class WorldDiffer

    Inheritance
    System.Object
    WorldDiffer
    Namespace: Unity.Entities
    Syntax
    public static class WorldDiffer

    Methods

    ApplyDiff(World, WorldDiff)

    Declaration
    public static void ApplyDiff(World dest, WorldDiff diff)
    Parameters
    Type Name Description
    World dest
    WorldDiff diff

    CreateDiff(World, World, Allocator)

    Create a diff of changes between beforeWorld and afterWorld. All entities to be considered for diffing must have an EntityGuid component with a unique GUID so that they can be matched between worlds. The resulting WorldDiff must be Disposed when no longer needed.

    Declaration
    public static WorldDiff CreateDiff(World afterWorld, World beforeWorld, Allocator resultAllocator)
    Parameters
    Type Name Description
    World afterWorld

    The world containing the new state.

    World beforeWorld

    The world containing the old state.

    Allocator resultAllocator

    The allocator to use when allocating WorldDiff data.

    Returns
    Type Description
    WorldDiff

    A WorldDiff containing the differences between the two worlds.

    DiffAndApply(World, World, World)

    Calculate differences between previousStateShadowWorld and newState, and apply them to dstEntityWorld. All entities to be considered for diffing must have an EntityGuid component with a unique GUID.

    Declaration
    public static void DiffAndApply(World newState, World previousStateShadowWorld, World dstEntityWorld)
    Parameters
    Type Name Description
    World newState

    The state to be updated to.

    World previousStateShadowWorld

    The shadow world (previous state) of the current state world.

    World dstEntityWorld

    The world to which to apply the updates to.

    Remarks

    previousShadowWorld must be a direct ancestor to the newState world, and must only be updated using this call or similar WorldDifffer methods. No direct changes to previousStateShadowWorld are allowed. After this call, previousShadowWorld will be updated to exactly match newState.

    Ordinal(Entity)

    Declaration
    public static ulong Ordinal(Entity e)
    Parameters
    Type Name Description
    Entity e
    Returns
    Type Description
    System.UInt64

    UpdateDiff(World, World, Allocator)

    Create a diff of changes between beforeWorld and afterWorld, and efficiently update beforeWorld to match afterWorld.

    Declaration
    public static WorldDiff UpdateDiff(World afterWorld, World beforeWorld, Allocator resultAllocator)
    Parameters
    Type Name Description
    World afterWorld

    The world containing the new state.

    World beforeWorld

    The world containing the old state.

    Allocator resultAllocator

    The allocator to use when allocating WorldDiff data.

    Returns
    Type Description
    WorldDiff

    A WorldDiff containing the differences between the two worlds.

    Remarks

    UpdateDiff is only valid if beforeWorld was only ever updated via one of the WorldDiffer methods that updates the "before" world and no other changes have been done to it. All entities to be considered for diffing must have an EntityGuid component with a unique GUID so that they can be matched between worlds. The resulting WorldDiff must be Disposed when no longer needed.

    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