Skip to content

Game.Prefabs.NetGeometryComposition

Assembly:
Game (assembly name may vary; typically part of the game's runtime assemblies)

Namespace:
Game.Prefabs

Type:
struct

Base:
IBufferElementData, IEmptySerializable

Summary:
NetGeometryComposition is a Unity ECS buffer element used to store a reference to a "composition" entity together with a bitmask describing which parts of that composition are relevant. It is annotated with InternalBufferCapacity(0) so the buffer has no inline capacity in the chunk and will allocate storage dynamically. The struct is also marked for the game's Colossal serialization system via IEmptySerializable.


Fields

  • public Entity m_Composition
    Holds an Entity reference pointing to a composition entity (the entity that contains the actual geometry/composition data). This is the primary link from the owner entity to the geometry composition.

  • public CompositionFlags m_Mask
    A bitmask (CompositionFlags) that indicates which sub-parts or layers of the composition are active/used. The exact meaning of each flag value is defined by the CompositionFlags enum in the codebase; it is typically used to enable/disable parts of the composed geometry.

Notes: - The struct is decorated with [InternalBufferCapacity(0)] meaning no preallocated inline buffer capacity in the chunk; buffers for this element will allocate storage separately. - Being an IBufferElementData makes instances usable in DynamicBuffer on ECS entities.

Properties

  • This type has no properties.

Constructors

  • public NetGeometryComposition()
    Structs in C# have an implicit parameterless constructor that zero-initializes fields. There is no explicit constructor defined in the source.

Methods

  • This type declares no instance methods. Serialization behavior is handled externally by the Colossal.Serialization system and the IEmptySerializable marker.

Usage Example

// Example: adding a composition element to an entity's buffer
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;

Entity someEntity = /* the entity that will reference a composition */;
Entity compositionEntity = /* the entity that holds the geometry composition */;
CompositionFlags mask = /* set appropriate flags */;

var buffer = entityManager.GetBuffer<NetGeometryComposition>(someEntity);
buffer.Add(new NetGeometryComposition {
    m_Composition = compositionEntity,
    m_Mask = mask
});

Additional notes: - Use DynamicBuffer to iterate or modify the list of associated compositions on an entity. - Because InternalBufferCapacity is 0, frequent additions may allocate memory; for performance-sensitive hot paths consider structuring data to minimize reallocations.