Game.Prefabs.LodMesh
Assembly:
Unknown (defined in mod/game code)
Namespace: Game.Prefabs
Type:
struct
Base:
IBufferElementData, IEmptySerializable
Summary:
A buffer element used by the ECS to store references to LOD (Level Of Detail) mesh entities. The struct is annotated with [InternalBufferCapacity(2)], which gives the DynamicBuffer a small inline capacity optimization to avoid heap allocations for up to two elements. The contained value, an Unity.Entities.Entity
, is intended to reference another ECS entity that represents the mesh to use at a particular LOD for a prefab or actor.
Fields
public Unity.Entities.Entity m_LodMesh
Holds the entity reference to the LOD mesh. As a buffer element, multipleLodMesh
entries can be attached to an entity using aDynamicBuffer<LodMesh>
to represent multiple LOD levels or variations.
Properties
- None
Constructors
- None (default value-type constructor)
Methods
- None
Remarks / Notes
- The attribute
[InternalBufferCapacity(2)]
is a Unity.Entities optimization hint: the buffer will have capacity for two elements without extra allocation, which is useful when most instances store only a small number of LODs. IEmptySerializable
is a marker from the Colossal.Serialization system used in Cities: Skylines 2 modding; it indicates the type participates in the game's custom serialization system (implementation details handled by the game's serializer).- Use this buffer element via
DynamicBuffer<LodMesh>
in systems or component setup when associating LOD mesh entities with a parent entity (prefab, building, etc.). Unity.Entities.Entity
is a DOTS ECS entity handle — it does not contain mesh data itself but refers to another entity that typically has rendering/mesh components.
Usage Example
// Add/modify a DynamicBuffer<LodMesh> in a system or component-authoring code
public partial class ConfigureLodSystem : SystemBase
{
protected override void OnUpdate()
{
Entities
.WithNone<SomeMarker>()
.ForEach((Entity entity, int entityInQueryIndex, ref DynamicBuffer<Game.Prefabs.LodMesh> lodBuffer) =>
{
// Clear existing entries and add two LOD mesh entity references
lodBuffer.Clear();
lodBuffer.Add(new Game.Prefabs.LodMesh { m_LodMesh = someLowDetailMeshEntity });
lodBuffer.Add(new Game.Prefabs.LodMesh { m_LodMesh = someHighDetailMeshEntity });
}).Schedule();
}
}