Game.Rendering.FadeBatch
Assembly: Assembly-CSharp (game assembly)
Namespace: Game.Rendering
Type: public struct FadeBatch
Base: Unity.Entities.IBufferElementData
Summary:
A lightweight buffer element used by the game's ECS to represent a single "fade" entry for rendering. Each element stores the source entity that originated the fade and a velocity vector (float3) that can be used by rendering or animation systems to compute motion/fade behaviour. The type is attributed with [InternalBufferCapacity(0)], so instances are intended to be stored in a dynamic buffer with no inline (embedded) capacity — elements are stored externally in the entity's dynamic buffer storage.
Fields
-
public Unity.Entities.Entity m_Source
Holds the Entity that is the source/owner of this fade entry. Systems reading fade batches can use this to look up additional components or metadata from the source entity. -
public Unity.Mathematics.float3 m_Velocity
A float3 that describes a velocity or direction associated with the fade. Rendering or simulation code can use this to offset, animate, or compute fade progression.
Notes:
- The struct contains only blittable types (Entity and float3), so it is safe for use inside jobs and with Burst.
- The type is a buffer element (IBufferElementData) — accessed at runtime via DynamicBuffer
Properties
- None (this struct exposes only public fields; no properties are defined).
Constructors
public FadeBatch()
(implicit default)
The struct uses the implicit parameterless constructor provided by C#. Initialize fields directly when creating instances (e.g., new FadeBatch { m_Source = source, m_Velocity = velocity }).
Methods
- None (no methods are declared on this buffer element).
Usage Example
// Example: adding a FadeBatch entry to an entity's dynamic buffer inside a system
public partial class FadeProducerSystem : SystemBase
{
protected override void OnUpdate()
{
Entity sourceEntity = /* obtain source entity */;
float3 velocity = new float3(0f, -1f, 0f);
Entities
.WithName("AddFadeBatch")
.ForEach((Entity e, ref DynamicBuffer<Game.Rendering.FadeBatch> fades) =>
{
fades.Add(new Game.Rendering.FadeBatch
{
m_Source = sourceEntity,
m_Velocity = velocity
});
}).Schedule();
}
}
// Or using EntityManager:
var buffer = entityManager.GetBuffer<Game.Rendering.FadeBatch>(someEntity);
buffer.Add(new Game.Rendering.FadeBatch { m_Source = sourceEntity, m_Velocity = float3.zero });
Additional remarks:
- Because of [InternalBufferCapacity(0)], buffer contents are not stored inline in the entity and may have different allocation/iteration characteristics than buffers with inline capacity — design your systems with that in mind for performance.
- Use DynamicBuffer