docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct ExclusiveEntityTransaction

    Provides an interface to safely perform a subset of EntityManager operations from a single worker thread, by temporarily giving that thread exclusive access to a World's EntityManager.

    Namespace: Unity.Entities
    Assembly: Unity.Entities.dll
    Syntax
    public struct ExclusiveEntityTransaction
    Remarks

    The intended use case for this interface is to let a worker thread stream Entity data into a staging World and perform any necessary post-processing structural changes, prior to moving the final data into the main simulation world using MoveEntitiesFrom(EntityManager). This lets the main thread continue to safely process the primary world while the new data is loading in, and not require a main-thread sync point until the new Entities are fully loaded and ready to be injected.

    Warning: Only the EntityManager operations exposed by this struct are supported within the context of an exclusive entity transaction. For more information, refer to Safety in Entities.

    Properties

    Name Description
    EntityManager

    Return the entity manager this transaction operates upon.

    Methods

    Name Description
    AddBuffer<T>(Entity)

    Adds a dynamic buffer component to an entity.

    AddComponent(Entity, ComponentType)

    Adds a component to an entity.

    AddSharedComponentData<T>(Entity, T)

    Obsolete. Use AddSharedComponentManaged<T>(Entity, T) instead.

    AddSharedComponentManaged<T>(NativeArray<Entity>, T)

    Adds a shared component to an array of entities

    AddSharedComponentManaged<T>(Entity, T)

    Adds a shared component to an entity.

    AddSharedComponent<T>(NativeArray<Entity>, T)

    Adds a shared component to multiple entities

    AddSharedComponent<T>(Entity, T)

    Adds a shared component to an entity.

    CreateArchetype(params ComponentType[])

    Creates an archetype from a set of component types.

    CreateEntity(params ComponentType[])

    Creates an entity having components of the specified types.

    CreateEntity(EntityArchetype)

    Creates an entity having the specified archetype.

    CreateEntity(EntityArchetype, NativeArray<Entity>)

    Creates a set of entities of the specified archetype.

    DestroyEntity(NativeArray<Entity>)

    Destroys all entities in an array.

    DestroyEntity(NativeSlice<Entity>)

    Destroys all entities in a slice of an array.

    DestroyEntity(Entity)

    Destroys an entity.

    Exists(Entity)

    Reports whether an Entity object is still valid.

    GetBuffer<T>(Entity, bool)

    Gets the dynamic buffer of an entity.

    GetComponentData<T>(Entity)

    Gets the value of a component for an entity.

    GetSharedComponentData<T>(Entity)

    Obsolete. Use GetSharedComponentManaged<T>(Entity) instead.

    GetSharedComponentManaged<T>(Entity)

    Gets a shared component from an entity.

    GetSharedComponent<T>(Entity)

    Gets a shared component from an entity.

    HasBuffer<T>(Entity)

    Checks whether an entity has a dynamic buffer of a specific IBufferElementData type.

    HasComponent(Entity, ComponentType)

    Checks whether an entity has a specific type of component.

    Instantiate(Entity)

    Clones an entity.

    Instantiate(Entity, NativeArray<Entity>)

    Makes multiple clones of an entity.

    IsComponentEnabled(Entity, ComponentType)

    Checks whether a given ComponentType is enabled on the specified Entity.

    IsComponentEnabled<T>(Entity)

    Checks whether a given ComponentType is enabled on the specified Entity.

    RemoveComponent(Entity, ComponentType)

    Removes a component from an entity.

    SetComponentData<T>(Entity, T)

    Sets the value of a component of an entity.

    SetComponentEnabled(Entity, ComponentType, bool)

    Enable or disable ComponentType on the specified Entity.

    SetComponentEnabled<T>(Entity, bool)

    Enable or disable a ComponentType on the specified Entity.

    SetSharedComponentData<T>(Entity, T)

    Obsolete. Use SetSharedComponentManaged<T>(Entity, T) instead.

    SetSharedComponentManaged<T>(NativeArray<Entity>, T)

    Sets the shared component on an array of entities

    SetSharedComponentManaged<T>(Entity, T)

    Sets the shared component of an entity.

    SetSharedComponent<T>(NativeArray<Entity>, T)

    Sets the shared component value on an array of entities

    SetSharedComponent<T>(Entity, T)

    Sets the shared component of an entity.

    SwapComponents(ArchetypeChunk, int, ArchetypeChunk, int)

    Swaps the components of two entities.

    See Also

    BeginExclusiveEntityTransaction()
    EndExclusiveEntityTransaction()

    Did you find this page useful? Please give it a rating:

    Thanks for rating this page!

    Report a problem on this page

    What kind of problem would you like to report?

    • This page needs code samples
    • Code samples do not work
    • Information is missing
    • Information is incorrect
    • Information is unclear or confusing
    • There is a spelling/grammar error on this page
    • Something else

    Thanks for letting us know! This page has been marked for review based on your feedback.

    If you have time, you can provide more information to help us fix the problem faster.

    Provide more information

    You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:

    You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:

    You've told us there is information missing from this page. Please tell us more about what's missing:

    You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:

    You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:

    You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:

    You've told us this page has a problem. Please tell us more about what's wrong:

    Thank you for helping to make the Unity documentation better!

    Your feedback has been submitted as a ticket for our documentation team to review.

    We are not able to reply to every ticket submitted.

    In This Article
    • Properties
    • Methods
    • See Also
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)