Class EntityQueryManagedComponentExtensions | Entities | 0.10.0-preview.6
image/svg+xml
docs.unity3d.com
  • Manual
  • Scripting API
  • Changelog
  • License
    Show / Hide Table of Contents
    • Unity.​Assertions
      • Assert
    • Unity.​Core
      • Time​Data
      • XXHash
    • Unity.​Deformations
      • Blend​Shape​Weight
      • Skin​Matrix
    • Unity.​Entities
      • Always​Synchronize​System​Attribute
      • Always​Update​System​Attribute
      • Archetype​Chunk
      • Archetype​Chunk​Array
      • Archetype​Chunk​Buffer​Type<T>
      • Archetype​Chunk​Component​Objects<T>
      • Archetype​Chunk​Component​Type<T>
      • Archetype​Chunk​Component​Type​Dynamic
      • Archetype​Chunk​Entity​Type
      • Archetype​Chunk​Iterator
      • Archetype​Chunk​Shared​Component​Type<T>
      • Asset
      • Begin​Initialization​Entity​Command​Buffer​System
      • Begin​Presentation​Entity​Command​Buffer​System
      • Begin​Simulation​Entity​Command​Buffer​System
      • Blob​Array<T>
      • Blob​Asset​Change
      • Blob​Asset​Computation​Context<TS, TB>
      • Blob​Asset​Reference<T>
      • Blob​Asset​Reference​Change
      • Blob​Asset​Serialize​Extensions
      • Blob​Asset​Store
      • Blob​Builder
      • Blob​Builder​Array<T>
      • Blob​Ptr<T>
      • Blob​String
      • Blob​String​Extensions
      • Buffer​Accessor<T>
      • Buffer​From​Entity<T>
      • Changed​Filter​Attribute
      • Change​Version​Utility
      • Chunk​Entities​Description
      • Chunk​Header
      • Chunk​Serializable​Attribute
      • Component​Data​From​Entity<T>
      • Component​System
      • Component​System​Base
      • Component​System​Base​Managed​Component​Extensions
      • Component​System​Group
      • Component​System​Group​Extensions
      • Component​System​Sorter
      • Component​System​Sorter.​Circular​System​Dependency​Exception
      • Component​System​Sorter.​Type​Heap​Element
      • Component​Type
      • Component​Type.​Access​Mode
      • Component​Type​Flags
      • Component​Type​Hash
      • Component​Types
      • Component​Types.​Masks
      • Converter​Version​Attribute
      • Convert​To​Entity
      • Convert​To​Entity.​Mode
      • Convert​To​Entity​System
      • Default​World​Initialization
      • Disable​Auto​Creation​Attribute
      • Disable​Auto​Type​Registration
      • Disabled
      • Disallow​Ref​Return​Crossing​This​Attribute
      • Dynamic​Buffer<T>
      • Editor​Render​Data
      • End​Initialization​Entity​Command​Buffer​System
      • End​Simulation​Entity​Command​Buffer​System
      • Entity
      • Entity​Archetype
      • Entity​Changes
      • Entity​Change​Set
      • Entity​Command​Buffer
      • Entity​Command​Buffer.​Concurrent
      • Entity​Command​Buffer​Managed​Component​Extensions
      • Entity​Command​Buffer​System
      • Entity​Container
      • Entity​Guid
      • Entity​In​Chunk
      • Entity​Manager
      • Entity​Manager.​Entity​Manager​Debug
      • Entity​Manager​Differ
      • Entity​Manager​Differ​Options
      • Entity​Manager​Extensions
      • Entity​Manager​Managed​Component​Extensions
      • Entity​Manager​Null​Shim
      • Entity​Patcher
      • Entity​Query
      • Entity​Query​Builder
      • Entity​Query​Desc
      • Entity​Query​Desc​Validation​Exception
      • Entity​Query​Extensions​For​Component​Array
      • Entity​Query​Extensions​For​Transform​Access​Array
      • Entity​Query​Managed​Component​Extensions
      • Entity​Query​Mask
      • Entity​Query​Null​Shim
      • Entity​Query​Options
      • Entity​Reference​Change
      • Entity​Remap​Utility
      • Entity​Remap​Utility.​Buffer​Entity​Patch​Info
      • Entity​Remap​Utility.​Entity​Patch​Info
      • Entity​Remap​Utility.​Entity​Remap​Info
      • Entity​Remap​Utility.​Managed​Entity​Patch​Info
      • Exclude​Component<T>
      • Exclude​Component​Attribute
      • Exclusive​Entity​Transaction
      • Fast​Equality
      • Fast​Equality.​Layout
      • Fast​Equality.​Type​Info
      • Fast​Equality.​Type​Info.​Compare​Equal​Delegate
      • Fast​Equality.​Type​Info.​Get​Hash​Code​Delegate
      • Fast​Equality.​Type​Info.​Managed​Compare​Equal​Delegate
      • Fast​Equality.​Type​Info.​Managed​Get​Hash​Code​Delegate
      • Fixed​Rate​Utils
      • For​Each​Lambda​Job​Description_Set​Shared​Component
      • Game​Object​Conversion​Settings
      • Game​Object​Conversion​Utility
      • Game​Object​Conversion​Utility.​Conversion​Flags
      • Game​Object​Entity
      • Generate​Authoring​Component​Attribute
      • Hash128
      • IBuffer​Element​Data
      • IComponent​Data
      • IConvert​Game​Object​To​Entity
      • ICustom​Bootstrap
      • IDeclare​Referenced​Prefabs
      • IJob​Chunk
      • IJob​Entity​Batch
      • Initialization​System​Group
      • Internal​Buffer​Capacity​Attribute
      • Internal​Compiler​Interface
      • Internal​Compiler​Interface.​Job​Chunk​Run​Without​Job​System​Delegate
      • Internal​Compiler​Interface.​Job​Run​Without​Job​System​Delegate
      • IRef​Counted
      • IShared​Component​Data
      • ISystem​State​Buffer​Element​Data
      • ISystem​State​Component​Data
      • ISystem​State​Shared​Component​Data
      • Job​Chunk​Extensions
      • Job​Component​System
      • Job​Entity​Batch​Extensions
      • Job​For​Each​Extensions
      • Job​For​Each​Extensions.​IBase​Job​For​Each
      • Lambda​Job​Chunk​Description_Set​Shared​Component
      • Lambda​Job​Chunk​Description​Construction​Methods
      • Lambda​Job​Chunk​Description​Construction​Methods.​Job​Chunk​Delegate
      • Lambda​Job​Description​Construction​Methods
      • Lambda​Job​Description​Execution​Methods
      • Lambda​Job​Description​Execution​Methods​JCS
      • Lambda​Job​Query​Construction​Methods
      • Lambda​Single​Job​Description​Construction​Methods
      • Lambda​Single​Job​Description​Construction​Methods.​With​Code​Action
      • Lambda​Single​Job​Description​Execution​Methods
      • Lambda​Single​Job​Description​Execution​Methods​JCS
      • Late​Simulation​System​Group
      • Layer​Field​Attribute
      • Layout​Utility
      • Layout​Utility​Managed
      • Linked​Entity​Group
      • Linked​Entity​Group​Change
      • Maximum​Chunk​Capacity​Attribute
      • May​Only​Live​In​Blob​Storage​Attribute
      • Memset​Native​Array<T>
      • Native​Array​Shared​Int
      • Packed​Component
      • Packed​Component​Data​Change
      • Packed​Managed​Component​Data​Change
      • Packed​Shared​Component​Data​Change
      • Playback​Policy
      • Post​Load​Command​Buffer
      • Prefab
      • Presentation​System​Group
      • Referenced​Unity​Objects
      • Register​Generic​Component​Type​Attribute
      • Request​Scene​Loaded
      • Require​Component​Tag​Attribute
      • Requires​Entity​Conversion​Attribute
      • Restrict​Authoring​Input​To​Attribute
      • Scene​Bounding​Volume
      • Scene​Load​Flags
      • Scene​Reference
      • Scene​Section
      • Scene​Section​Data
      • Scene​Tag
      • Scene​View​World​Position​Attribute
      • Script​Behaviour​Update​Order
      • Section​Metadata​Setup
      • Simulation​System​Group
      • SOAField​Info
      • Static​Optimize​Entity
      • System​Base
      • System​Base​Registry
      • System​Base​Registry.​Forwarding​Func
      • System​State
      • Type​Hash
      • Type​Manager
      • Type​Manager.​Entity​Offset​Info
      • Type​Manager.​Forced​Memory​Ordering​Attribute
      • Type​Manager.​Type​Category
      • Type​Manager.​Type​Info
      • Type​Manager.​Type​Info​Debug
      • Type​Manager.​Type​Version​Attribute
      • Update​After​Attribute
      • Update​Before​Attribute
      • Update​In​Group​Attribute
      • Update​World​Time​System
      • World
      • World.​No​Alloc​Read​Only​Collection<T>
      • World​Extensions
      • World​Flags
      • World​System​Filter​Attribute
      • World​System​Filter​Flags
      • Write​Group​Attribute
    • Unity.​Entities.​Build​Utils
      • Mono​Extensions
      • Type​Hash
      • Type​Utils
      • Type​Utils.​Align​And​Size
    • Unity.​Entities.​Conversion
      • Multi​List​Enumerator<T>
    • Unity.​Entities.​Editor
      • Entity​Selection​Proxy
      • Entity​Selection​Proxy.​Entity​Control​Select​Button​Handler
      • Extra​Types​Provider
      • Game​Object​Entity​Editor
      • Start​Live​Link​Window
    • Unity.​Entities.​Hybrid
      • Resource​Catalog​Data
      • Resource​Meta​Data
      • Resource​Meta​Data.​Flags
      • Resource​Meta​Data.​Type
    • Unity.​Entities.​Hybrid.​Internal
      • Generated​Authoring​Component​Implementation
    • Unity.​Entities.​IL2CPPProcessing
      • Component​System​Processing
    • Unity.​Entities.​Serialization
      • Binary​Reader
      • Binary​Reader​Extensions
      • Binary​Writer
      • Binary​Writer​Extensions
      • Memory​Binary​Reader
      • Memory​Binary​Writer
      • Serialize​Utility
      • Serialize​Utility​Hybrid
      • Stream​Binary​Reader
      • Stream​Binary​Writer
    • Unity.​Entities.​Streaming
      • Entity​Scene​Optimization
    • Unity.​Entities.​Universal​Delegates
      • I<T0>
      • II<T0, T1>
      • III<T0, T1, T2>
      • IIII<T0, T1, T2, T3>
      • IIIII<T0, T1, T2, T3, T4>
      • IIIIII<T0, T1, T2, T3, T4, T5>
      • IIIIIII<T0, T1, T2, T3, T4, T5, T6>
      • IIIIIIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • R<T0>
      • RI<T0, T1>
      • RII<T0, T1, T2>
      • RIII<T0, T1, T2, T3>
      • RIIII<T0, T1, T2, T3, T4>
      • RIIIII<T0, T1, T2, T3, T4, T5>
      • RIIIIII<T0, T1, T2, T3, T4, T5, T6>
      • RIIIIIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • RR<T0, T1>
      • RRI<T0, T1, T2>
      • RRII<T0, T1, T2, T3>
      • RRIII<T0, T1, T2, T3, T4>
      • RRIIII<T0, T1, T2, T3, T4, T5>
      • RRIIIII<T0, T1, T2, T3, T4, T5, T6>
      • RRIIIIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • RRR<T0, T1, T2>
      • RRRI<T0, T1, T2, T3>
      • RRRII<T0, T1, T2, T3, T4>
      • RRRIII<T0, T1, T2, T3, T4, T5>
      • RRRIIII<T0, T1, T2, T3, T4, T5, T6>
      • RRRIIIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • RRRR<T0, T1, T2, T3>
      • RRRRI<T0, T1, T2, T3, T4>
      • RRRRII<T0, T1, T2, T3, T4, T5>
      • RRRRIII<T0, T1, T2, T3, T4, T5, T6>
      • RRRRIIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • RRRRR<T0, T1, T2, T3, T4>
      • RRRRRI<T0, T1, T2, T3, T4, T5>
      • RRRRRII<T0, T1, T2, T3, T4, T5, T6>
      • RRRRRIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • RRRRRR<T0, T1, T2, T3, T4, T5>
      • RRRRRRI<T0, T1, T2, T3, T4, T5, T6>
      • RRRRRRII<T0, T1, T2, T3, T4, T5, T6, T7>
      • RRRRRRR<T0, T1, T2, T3, T4, T5, T6>
      • RRRRRRRI<T0, T1, T2, T3, T4, T5, T6, T7>
      • RRRRRRRR<T0, T1, T2, T3, T4, T5, T6, T7>
      • V<T0>
      • VI<T0, T1>
      • VII<T0, T1, T2>
      • VIII<T0, T1, T2, T3>
      • VIIII<T0, T1, T2, T3, T4>
      • VIIIII<T0, T1, T2, T3, T4, T5>
      • VIIIIII<T0, T1, T2, T3, T4, T5, T6>
      • VIIIIIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VR<T0, T1>
      • VRI<T0, T1, T2>
      • VRII<T0, T1, T2, T3>
      • VRIII<T0, T1, T2, T3, T4>
      • VRIIII<T0, T1, T2, T3, T4, T5>
      • VRIIIII<T0, T1, T2, T3, T4, T5, T6>
      • VRIIIIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VRR<T0, T1, T2>
      • VRRI<T0, T1, T2, T3>
      • VRRII<T0, T1, T2, T3, T4>
      • VRRIII<T0, T1, T2, T3, T4, T5>
      • VRRIIII<T0, T1, T2, T3, T4, T5, T6>
      • VRRIIIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VRRR<T0, T1, T2, T3>
      • VRRRI<T0, T1, T2, T3, T4>
      • VRRRII<T0, T1, T2, T3, T4, T5>
      • VRRRIII<T0, T1, T2, T3, T4, T5, T6>
      • VRRRIIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VRRRR<T0, T1, T2, T3, T4>
      • VRRRRI<T0, T1, T2, T3, T4, T5>
      • VRRRRII<T0, T1, T2, T3, T4, T5, T6>
      • VRRRRIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VRRRRR<T0, T1, T2, T3, T4, T5>
      • VRRRRRI<T0, T1, T2, T3, T4, T5, T6>
      • VRRRRRII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VRRRRRR<T0, T1, T2, T3, T4, T5, T6>
      • VRRRRRRI<T0, T1, T2, T3, T4, T5, T6, T7>
      • VRRRRRRR<T0, T1, T2, T3, T4, T5, T6, T7>
      • VV<T0, T1>
      • VVI<T0, T1, T2>
      • VVII<T0, T1, T2, T3>
      • VVIII<T0, T1, T2, T3, T4>
      • VVIIII<T0, T1, T2, T3, T4, T5>
      • VVIIIII<T0, T1, T2, T3, T4, T5, T6>
      • VVIIIIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVR<T0, T1, T2>
      • VVRI<T0, T1, T2, T3>
      • VVRII<T0, T1, T2, T3, T4>
      • VVRIII<T0, T1, T2, T3, T4, T5>
      • VVRIIII<T0, T1, T2, T3, T4, T5, T6>
      • VVRIIIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVRR<T0, T1, T2, T3>
      • VVRRI<T0, T1, T2, T3, T4>
      • VVRRII<T0, T1, T2, T3, T4, T5>
      • VVRRIII<T0, T1, T2, T3, T4, T5, T6>
      • VVRRIIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVRRR<T0, T1, T2, T3, T4>
      • VVRRRI<T0, T1, T2, T3, T4, T5>
      • VVRRRII<T0, T1, T2, T3, T4, T5, T6>
      • VVRRRIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVRRRR<T0, T1, T2, T3, T4, T5>
      • VVRRRRI<T0, T1, T2, T3, T4, T5, T6>
      • VVRRRRII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVRRRRR<T0, T1, T2, T3, T4, T5, T6>
      • VVRRRRRI<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVRRRRRR<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVV<T0, T1, T2>
      • VVVI<T0, T1, T2, T3>
      • VVVII<T0, T1, T2, T3, T4>
      • VVVIII<T0, T1, T2, T3, T4, T5>
      • VVVIIII<T0, T1, T2, T3, T4, T5, T6>
      • VVVIIIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVR<T0, T1, T2, T3>
      • VVVRI<T0, T1, T2, T3, T4>
      • VVVRII<T0, T1, T2, T3, T4, T5>
      • VVVRIII<T0, T1, T2, T3, T4, T5, T6>
      • VVVRIIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVRR<T0, T1, T2, T3, T4>
      • VVVRRI<T0, T1, T2, T3, T4, T5>
      • VVVRRII<T0, T1, T2, T3, T4, T5, T6>
      • VVVRRIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVRRR<T0, T1, T2, T3, T4, T5>
      • VVVRRRI<T0, T1, T2, T3, T4, T5, T6>
      • VVVRRRII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVRRRR<T0, T1, T2, T3, T4, T5, T6>
      • VVVRRRRI<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVRRRRR<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVV<T0, T1, T2, T3>
      • VVVVI<T0, T1, T2, T3, T4>
      • VVVVII<T0, T1, T2, T3, T4, T5>
      • VVVVIII<T0, T1, T2, T3, T4, T5, T6>
      • VVVVIIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVVR<T0, T1, T2, T3, T4>
      • VVVVRI<T0, T1, T2, T3, T4, T5>
      • VVVVRII<T0, T1, T2, T3, T4, T5, T6>
      • VVVVRIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVVRR<T0, T1, T2, T3, T4, T5>
      • VVVVRRI<T0, T1, T2, T3, T4, T5, T6>
      • VVVVRRII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVVRRR<T0, T1, T2, T3, T4, T5, T6>
      • VVVVRRRI<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVVRRRR<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVVV<T0, T1, T2, T3, T4>
      • VVVVVI<T0, T1, T2, T3, T4, T5>
      • VVVVVII<T0, T1, T2, T3, T4, T5, T6>
      • VVVVVIII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVVVR<T0, T1, T2, T3, T4, T5>
      • VVVVVRI<T0, T1, T2, T3, T4, T5, T6>
      • VVVVVRII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVVVRR<T0, T1, T2, T3, T4, T5, T6>
      • VVVVVRRI<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVVVRRR<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVVVV<T0, T1, T2, T3, T4, T5>
      • VVVVVVI<T0, T1, T2, T3, T4, T5, T6>
      • VVVVVVII<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVVVVR<T0, T1, T2, T3, T4, T5, T6>
      • VVVVVVRI<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVVVVRR<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVVVVV<T0, T1, T2, T3, T4, T5, T6>
      • VVVVVVVI<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVVVVVR<T0, T1, T2, T3, T4, T5, T6, T7>
      • VVVVVVVV<T0, T1, T2, T3, T4, T5, T6, T7>
    • Unity.​Mathematics
      • AABB
      • AABBExtensions
      • Generate​Points
      • Min​Max​AABB
    • Unity.​Profiling
      • Profiler​Marker
      • Profiler​Marker.​Auto​Scope
    • Unity.​Scenes
      • Disable​Scene​Resolve​And​Load
      • Live​Link​Mode
      • Resolved​Section​Entity
      • Resolve​Scene​Section​Utility
      • Scene​Bundle​Handle
      • Scene​System
      • Scene​System.​Load​Parameters
      • Scene​System.​Unload​Parameters
      • Scene​System​Group
      • Sub​Scene
    • Unity.​Scenes.​Editor
      • Editor​Entity​Scenes
      • Live​Link​Build​Importer
      • Live​Link​Build​Importer.​Build​Meta​Data
      • Scene​Importer​Data
      • Scene​Inspector
    • Unity.​Transforms
      • Bone​Index​Offset
      • Child
      • Composite​Rotation
      • Composite​Rotation​System
      • Composite​Scale
      • Composite​Scale​System
      • Copy​Initial​Transform​From​Game​Object
      • Copy​Initial​Transform​From​Game​Object​System
      • Copy​Transform​From​Game​Object
      • Copy​Transform​From​Game​Object​System
      • Copy​Transform​To​Game​Object
      • Copy​Transform​To​Game​Object​System
      • End​Frame​Composite​Rotation​System
      • End​Frame​Composite​Scale​System
      • End​Frame​Local​To​Parent​System
      • End​Frame​Parent​Scale​Inverse​System
      • End​Frame​Parent​System
      • End​Frame​Post​Rotation​Euler​System
      • End​Frame​Rotation​Euler​System
      • End​Frame​TRSTo​Local​To​Parent​System
      • End​Frame​TRSTo​Local​To​World​System
      • End​Frame​World​To​Local​System
      • Frozen
      • Local​To​Parent
      • Local​To​Parent​System
      • Local​To​World
      • Non​Uniform​Scale
      • Parent
      • Parent​Scale​Inverse
      • Parent​Scale​Inverse​System
      • Parent​System
      • Post​Rotation
      • Post​Rotation​Euler​System
      • Post​Rotation​Euler​XYZ
      • Post​Rotation​Euler​XZY
      • Post​Rotation​Euler​YXZ
      • Post​Rotation​Euler​YZX
      • Post​Rotation​Euler​ZXY
      • Post​Rotation​Euler​ZYX
      • Previous​Parent
      • Rotation
      • Rotation​Euler​System
      • Rotation​Euler​XYZ
      • Rotation​Euler​XZY
      • Rotation​Euler​YXZ
      • Rotation​Euler​YZX
      • Rotation​Euler​ZXY
      • Rotation​Euler​ZYX
      • Rotation​Pivot
      • Rotation​Pivot​Translation
      • Scale
      • Scale​Pivot
      • Scale​Pivot​Translation
      • Static
      • Transform​System​Group
      • Translation
      • TRSTo​Local​To​Parent​System
      • TRSTo​Local​To​World​System
      • World​To​Local
      • World​To​Local​System
    • Scripting API
    • Unity.​Entities
    • Entity​Query​Managed​Component​Extensions

    Class EntityQueryManagedComponentExtensions

    Inheritance
    Object
    EntityQueryManagedComponentExtensions
    Namespace: Unity.Entities
    Syntax
    public static class EntityQueryManagedComponentExtensions

    Methods

    GetSingleton<T>(EntityQuery)

    Gets the value of a singleton component.

    Declaration
    public static T GetSingleton<T>(this EntityQuery query)
        where T : class, IComponentData
    Parameters
    Type Name Description
    EntityQuery query
    Returns
    Type Description
    T

    A copy of the singleton component.

    Type Parameters
    Name Description
    T

    The component type.

    Remarks

    A singleton component is a component of which only one instance exists that satisfies this query.

    Exceptions
    Type Condition
    InvalidOperationException
    See Also
    GetSingleton<T>()

    SetSingleton<T>(EntityQuery, T)

    Sets the value of a singleton component.

    Declaration
    public static void SetSingleton<T>(this EntityQuery query, T value)
        where T : class, IComponentData
    Parameters
    Type Name Description
    EntityQuery query
    T value

    An instance of type T containing the values to set.

    Type Parameters
    Name Description
    T

    The component type.

    Remarks

    For a component to be a singleton, there can be only one instance of that component that satisfies this query.

    Note: singletons are otherwise normal entities. The EntityQuery and ComponentSystemBase singleton functions add checks that you have not created two instances of a type that can be accessed by this singleton query, but other APIs do not prevent such accidental creation.

    To create a singleton, create an entity with the singleton component.

    For example, if you had a component defined as:

        public struct Singlet : IComponentData
    {
       public int Value;
    }

    You could create a singleton as follows:

           Entity singletonEntity = entityManager.CreateEntity(typeof(Singlet));
           entityManager.SetComponentData(singletonEntity, new Singlet { Value = 1 });

    To update the singleton component after creation, you can use an EntityQuery object that selects the singleton entity and call this SetSingleton() function:

                queryForSingleton.SetSingleton<Singlet>(new Singlet {Value = 1});

    You can set and get the singleton value from a system: see SetSingleton<T>(T) and GetSingleton<T>().

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if more than one instance of this component type exists in the world or the component type appears in more than one archetype.

    See Also
    GetSingleton<T>(EntityQuery)
    GetSingletonEntity()
    In This Article
    • Methods
      • GetSingleton<T>(EntityQuery)
      • SetSingleton<T>(EntityQuery, T)
    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