Game.PreCullingData
Assembly: Assembly-CSharp
Namespace: Game.Rendering
Type: struct
Base: System.ValueType
Summary:
Container used by the rendering/pre-culling pipeline to describe a single entity's pre-culling state. This lightweight value type holds the entity reference, flags that control pre-culling behavior, a small signed frame index/marker for update tracking, and a compact timer. It is intended for high-throughput use (arrays, NativeList, jobs) and contains no logic—only raw data used by culling systems and jobs.
Fields
-
public Entity m_Entity
Reference to the Entity (Unity.Entities.Entity) that this pre-culling entry represents. Used to map pre-culling results back to ECS entities or to fetch components for visibility/culling decisions. -
public PreCullingFlags m_Flags
Bitflags controlling pre-culling behavior for the entity. The enum PreCullingFlags (not shown here) typically encodes states such as whether the object is eligible for pre-culling, whether it has dynamic bounds, forced-visible, etc. Check the PreCullingFlags definition for exact semantics. -
public sbyte m_UpdateFrame
Small signed frame marker used to track when this entry was last updated or to encode an update pass indicator. Using sbyte keeps the struct compact; wrap/overflow behavior should be handled by the system that updates this value. -
public byte m_Timer
Compact timer or counter (0–255) typically used for throttling or delaying re-checks of this entry across frames. The exact use depends on the culling implementation (for example, skipping expensive checks for a few frames).
Properties
- This struct has no properties. It only exposes the public fields above.
Constructors
public PreCullingData()
Default value-type constructor provided by the runtime. There are no explicit custom constructors in the source; initialize fields with an object initializer or by assigning fields directly.
Example initialization pattern:
var entry = new PreCullingData
{
m_Entity = someEntity,
m_Flags = PreCullingFlags.None,
m_UpdateFrame = (sbyte)currentFrameIndex,
m_Timer = 0
};
Methods
- This struct defines no methods. It is a plain data carrier intended for storage and transport between systems/jobs.
Usage Example
using Unity.Entities;
using Unity.Collections;
using Game.Rendering;
// Create and populate an entry
var entry = new PreCullingData
{
m_Entity = entity,
m_Flags = PreCullingFlags.None,
m_UpdateFrame = (sbyte)currentFrame,
m_Timer = 0
};
// Store in a NativeList for processing in a job/system
var list = new NativeList<PreCullingData>(Allocator.Temp);
// ... fill list ...
list.Add(entry);
// In a job or system, read the entry and perform pre-culling logic,
// then update m_UpdateFrame / m_Timer as needed before writing back.