Documentation

Unity Engine


Unity Engine


World

Encapsulates a set of entities, component data, and systems.
Read time 3 minutesLast updated 8 hours ago

Definition

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

Properties

Property

Description

CurrentGroupAllocatorsRetrieve current double rewindable allocator for this World.
QuitUpdateSet this property to true to abort a world update after the next system update.
SystemsList of all managed systems in this World
TimeSingletonSingleton instance of the WorldTime component. This data is generally accessed through Time.
UnmanagedGives access to the unmanaged data of an instance of the World. This is useful when your code needs to run with Burst.
UpdateAllocatorEnableBlockFreeProperty to get and set enable block free flag, a flag indicating whether the allocator should enable individual block to be freed.

Static Properties

Property

Description

AllList of all Worlds that currently exist in the application
DefaultGameObjectInjectionWorldThe default World. The code that runs outside a system reads this property to reach a world.

Methods

Method

Description

AddSystemManagedAdds an existing system instance to this World
CreateSystemCreate and return a handle to an instance of a system of type
type
in this World.
CreateSystemManagedCreate and return an instance of a system of type
type
in this World.
DestroyAllSystemsAndLogExceptionDestroy all system instances in the World. Any errors encountered during individual system destruction will be logged to the console.
DestroySystemDestroys one of the World's existing system instances.
DestroySystemManagedDestroys one of the World's existing system instances.
DisposeDispose of a World instance
GetExistingSystemReturn 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.
GetExistingSystemManagedReturn 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.
GetOrCreateSystemRetrieve 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.
GetOrCreateSystemManagedRetrieve 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.
GetOrCreateSystemsAndLogExceptionCreates systems from the list of types which aren't already created in the current world.
PopTimeRestore the previous World time, after pushing a temporary time value with World.PushTime
PushTimePush a new temporary time value to the World's current time
RestoreGroupAllocatorPop group allocator out of the stack.
SetGroupAllocatorPush group allocator into a stack.
SetTimeAssigns a new value to the World's current time.
ToStringReturns the name of the World
UpdateUpdate the World's default system groups.

Static Methods

Method

Description

DisposeAllWorldsDestroys all existing Worlds

Structs

Struct

Description

World.NoAllocReadOnlyCollection<T>Read only collection that doesn't generate garbage when used in a foreach.