Game.Prefabs.VFXData
Assembly:
Assembly-CSharp (typical for game mods; actual assembly may vary)
Namespace:
Game.Prefabs
Type:
struct (value type)
Base:
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
VFXData is a lightweight ECS component that stores small, plain-data state for VFX prefabs. It contains the maximum allowed instances for a VFX and a current index/counter. Because it implements IComponentData it is a blittable component suitable for use in Jobs and Burst-compiled systems. As an IQueryTypeParameter it can also be used as a query-type parameter in some Entity query APIs.
Fields
-
public System.Int32 m_MaxCount
Maximum number of simultaneous VFX instances or the configured capacity for this VFX prefab. Interpretation is up to the VFX/spawner logic (e.g., cap on concurrent particles, pooled instances, etc.). -
public System.Int32 m_Index
A small integer index or counter associated with the VFX (for example, next pool index, round-robin slot, or instance id). Managed by game/mod logic to track per-prefab state.
Properties
- This type defines no properties. It exposes two public fields (m_MaxCount, m_Index).
Constructors
public VFXData()
Structs have an implicit default constructor that initializes all fields to zero. Typical initialization should explicitly set meaningful values when adding the component to an entity (see Usage Example).
Methods
- This type defines no methods. It is a plain data container intended to be read/written by systems or jobs.
Usage Example
// Add the component to an entity (e.g., when creating a VFX prefab entity)
var entity = entityManager.CreateEntity();
entityManager.AddComponentData(entity, new VFXData {
m_MaxCount = 16,
m_Index = 0
});
// Example SystemBase usage: increment index round-robin while respecting max count
public partial class VFXSystem : SystemBase
{
protected override void OnUpdate()
{
Entities
.WithAll<VFXData>()
.ForEach((ref VFXData vfx) =>
{
// use the index and clamp/wrap by max count
vfx.m_Index = (vfx.m_Index + 1) % Math.Max(1, vfx.m_MaxCount);
// perform other VFX-related logic...
})
.ScheduleParallel();
}
}
Notes: - Because the struct is blittable and uses public fields, it is efficient for ECS access and job scheduling. Initialize fields explicitly when adding the component to avoid default-zero semantics that may not be meaningful for your VFX logic. - The exact semantics (what m_MaxCount and m_Index represent) depend on the mod/game systems that consume this component; adapt usage accordingly.