docs.unity.cn
    Show / Hide Table of Contents

    Class World

    Encapsulates a set of entities, component data, and systems.

    Inheritance
    Object
    World
    Namespace: Unity.Entities
    Syntax
    public class World : IDisposable
    Remarks

    Multiple Worlds may exist concurrently in the same application, but they are isolated from each other; an EntityQuery will only match entities in the World that created the query, a World's EntityManager can only process entities from the same World, etc.

    Constructors

    Name Description
    World(String, WorldFlags)

    Construct a new World instance

    World(String, WorldFlags, AllocatorManager.AllocatorHandle)

    Construct a new World instance

    Properties

    Name Description
    All

    List of all Worlds that currently exist in the application

    CurrentGroupAllocators

    Retrieve current double rewindable allocator for this World.

    DefaultGameObjectInjectionWorld

    Reference to the default World

    EntityManager

    An interface to manipulate the World's entity data from the main thread

    Flags

    The WorldFlags settings for this World

    IsCreated

    Has this World been successfully initialized?

    MaximumDeltaTime

    The maximum single-frame delta time permitted in this world.

    Name

    The name of the World

    NextSequenceNumber
    QuitUpdate

    Set this property to true to abort a world update after the next system update.

    SequenceNumber

    The World's current sequence number

    Systems

    List of all managed systems in this World

    Time

    The world's simulated time, include elapsed time since World creation and the delta time since the previous update.

    TimeSingleton

    Singleton instance of the Unity.Entities.WorldTime component. This data is generally accessed through Time.

    Unmanaged

    Gives access to the unmanaged data of an instance of the World. This is useful when your code needs to run with Burst.

    UpdateAllocator

    Rewindable allocator instance for this World.

    UpdateAllocatorEnableBlockFree

    Property to get and set enable block free flag, a flag indicating whether the allocator should enable individual block to be freed.

    Version

    The World's current version number

    Methods

    Name Description
    AddSystem<T>(T)

    Obsolete. Use AddSystemManaged<T>(T) instead.

    AddSystemManaged<T>(T)

    Adds an existing system instance to this World

    CreateSystem(Type)

    Create and return a handle to an instance of a system of type type in this World.

    CreateSystem(SystemTypeIndex)

    Create and return a handle to an instance of a system of with system type index typeIndex in this World.

    CreateSystem<T>()

    Create and return a handle to an instance of a system of type T in this World.

    CreateSystemManaged(Type)

    Create and return an instance of a system of type type in this World.

    CreateSystemManaged(SystemTypeIndex)

    Create and return an instance of a system of with system type index typeIndex in this World.

    CreateSystemManaged<T>()

    Create and return an instance of a system of type T in this World.

    DestroyAllSystemsAndLogException()

    Destroy all system instances in the World. Any errors encountered during individual system destruction will be logged to the console.

    DestroySystem(SystemHandle)

    Destroys one of the World's existing system instances.

    DestroySystemManaged(ComponentSystemBase)

    Destroys one of the World's existing system instances.

    Dispose()

    Dispose of a World instance

    DisposeAllWorlds()

    Destroys all existing Worlds

    GetExistingSystem(Type)

    Return a handle to an existing instance of a system of type type in this World. Prefer the version that takes a SystemTypeIndex where possible to avoid unnecessary reflection.

    GetExistingSystem(SystemTypeIndex)

    Return a handle to an existing instance of a system of type type in this World. This version avoids unnecessary reflection.

    GetExistingSystem<T>()

    Return a handle to an existing instance of a system of type T in this World.

    GetExistingSystemManaged(Type)

    Return an existing instance of a system of type type in this World. Prefer the version that takes a SystemTypeIndex where possible to avoid unnecessary reflection.

    GetExistingSystemManaged(SystemTypeIndex)

    Return an existing instance of a system of type type in this World. This avoids unnecessary reflection.

    GetExistingSystemManaged<T>()

    Return an existing instance of a system of type T in this World.

    GetOrCreateSystem(Type)

    Retrieve the handle for the instance of a system of type type from the current World. If the system does not exist in this World, it will first be created.

    GetOrCreateSystem(SystemTypeIndex)

    Retrieve the handle for the instance of a system with a given system type index typeIndex from the current World. If the system does not exist in this World, it will first be created.

    GetOrCreateSystem<T>()

    Retrieve the handle for the instance of a system of type T from the current World. If the system does not exist in this World, it will first be created.

    GetOrCreateSystemManaged(Type)

    Retrieve the instance of a system of type type from the current World. If the system does not exist in this World, it will first be created.

    GetOrCreateSystemManaged(SystemTypeIndex)

    Retrieve the instance of a system with a system type index typeIndex from the current World. If the system does not exist in this World, it will first be created.

    GetOrCreateSystemManaged<T>()

    Retrieve the instance of a system of type T from the current World. If the system does not exist in this World, it will first be created.

    GetOrCreateSystemsAndLogException(NativeList<SystemTypeIndex>, AllocatorManager.AllocatorHandle)

    Creates systems from the list of types which aren't already created in the current world.

    PopTime()

    Restore the previous World time, after pushing a temporary time value with PushTime(TimeData)

    PushTime(TimeData)

    Push a new temporary time value to the World's current time

    RestoreGroupAllocator(DoubleRewindableAllocators*)

    Pop group allocator out of the stack.

    SetGroupAllocator(DoubleRewindableAllocators*)

    Push group allocator into a stack.

    SetTime(TimeData)

    Assigns a new value to the World's current time.

    ToString()

    Returns the name of the World

    Update()

    Update the World's default system groups.

    Extension Methods

    WorldExtensions.CreateSystem<T>(World)
    WorldExtensions.GetExistingSystem<T>(World)
    WorldExtensions.GetOrCreateSystem<T>(World)
    WorldExtensions.AddSystem<T>(World)
    WorldExtensions.GetOrCreateUnmanagedSystem(World, Type)
    WorldExtensions.DestroyUnmanagedSystem(World, SystemHandle)
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Wednesday, June 21, 2023