Game.Prefabs.FeedbackCityEffectFactor
Assembly:
Game (Assembly-CSharp) {{ YOUR_INFO: This type is defined in the game's codebase; depending on build it may appear in Assembly-CSharp or a Game-specific assembly. }}
Namespace:
Game.Prefabs
Type:
struct
Base:
System.ValueType, Unity.Entities.IBufferElementData
Summary:
A lightweight buffer element used with Unity's Entity Component System (ECS) to store a single floating-point factor for city feedback effects. The struct is attributed with InternalBufferCapacity(256), which reserves space for up to 256 elements inline on the entity before additional memory allocations are required. It is blittable and suitable for use in jobs and Burst-compiled code. {{ YOUR_INFO: Use this element in a DynamicBuffer
Fields
public System.Single m_Factor
Holds the factor value for this buffer element (single-precision float). {{ YOUR_INFO: This is a plain float field and will be zero-initialized by default. It is the payload you store per buffer element. }}
Properties
- (none)
{{ YOUR_INFO: This type exposes no properties; access the field directly when working with buffer elements. }}
Constructors
public FeedbackCityEffectFactor()
Default value-type constructor (zero-initializes m_Factor). {{ YOUR_INFO: The source file doesn't declare an explicit constructor. You can construct instances using an object initializer, e.g. new FeedbackCityEffectFactor { m_Factor = 1.0f }; }}
Methods
- (none)
{{ YOUR_INFO: There are no methods on this struct. Behavior is provided by reading/writing instances inside a DynamicBuffervia the EntityManager or within ECS systems. }}
Usage Example
// Add a dynamic buffer to an entity and populate it
EntityManager.AddBuffer<FeedbackCityEffectFactor>(entity);
// Retrieve and use the buffer (can be done inside a System or a Job compatible context)
var buffer = EntityManager.GetBuffer<FeedbackCityEffectFactor>(entity);
buffer.Add(new FeedbackCityEffectFactor { m_Factor = 1.25f });
buffer.Add(new FeedbackCityEffectFactor { m_Factor = 0.75f });
// Example inside a ComponentSystem or SystemBase
Entities.ForEach((Entity e, ref SomeComponent c) =>
{
var fb = EntityManager.GetBuffer<FeedbackCityEffectFactor>(e);
for (int i = 0; i < fb.Length; i++)
{
float factor = fb[i].m_Factor;
// use factor...
}
}).Run();
{{ YOUR_INFO: Notes:
- InternalBufferCapacity(256) means up to 256 elements are stored inline on the entity (no heap allocation). If more elements are added, the buffer will allocate additional memory.
- Since this is an IBufferElementData with a single float field, it is suitable for use in jobs and Burst-compiled code (blittable).
- Prefer using EntityManager or SystemBase APIs (GetBuffer / AddBuffer) to manipulate DynamicBuffer