Skip to content

Game.Prefabs.FeedbackLocalEffectFactor

Assembly:
Assembly-CSharp (game assembly)

Namespace:
Game.Prefabs

Type:
struct

Base:
System.ValueType, Unity.Entities.IBufferElementData

Summary:
Represents a single buffer element used to store a local feedback/effect multiplier (a float factor) for an entity. The struct is annotated with [InternalBufferCapacity(256)], which reserves space for up to 256 elements in the entity's DynamicBuffer before additional heap allocations are required. This is typically used in ECS systems to attach a variable-length list of effect factors to an entity (for example, local visual/audio/physics feedback intensity modifiers).


Fields

  • public float m_Factor
    The stored factor value (float). Represents the multiplier or strength of the local effect for this element. Default value is 0.0f for newly created instances.

  • Attribute: [InternalBufferCapacity(256)]
    Indicates the default internal capacity reserved for the DynamicBuffer holding these elements; helps minimize allocations when buffers are frequently sized up to this number.

Properties

  • None
    This is a simple POD buffer element; it exposes its data via the public field m_Factor rather than properties.

Constructors

  • Implicit default constructor (value-initialized)
    Structs in C# have an implicit default constructor that initializes m_Factor to 0.0f. No custom constructors are defined.

Methods

  • None
    This type contains only data; any logic to manipulate the buffer should be implemented in systems operating on DynamicBuffer.

Usage Example

// Get or add a DynamicBuffer on an entity and add a new factor element
var buffer = entityManager.GetBuffer<FeedbackLocalEffectFactor>(entity);
buffer.Add(new FeedbackLocalEffectFactor { m_Factor = 1.0f });

// Example inside a System (Entities.ForEach)
Entities.ForEach((ref DynamicBuffer<FeedbackLocalEffectFactor> factors) =>
{
    // iterate
    for (int i = 0; i < factors.Length; i++)
    {
        float factor = factors[i].m_Factor;
        // modify
        factors[i] = new FeedbackLocalEffectFactor { m_Factor = factor * 0.9f };
    }

    // append a new factor
    factors.Add(new FeedbackLocalEffectFactor { m_Factor = 0.5f });
}).Schedule();