Skip to content

Game.Prefabs.NetPollutionData

Assembly:
Assembly-CSharp

Namespace:
Game.Prefabs

Type:
public struct

Base:
IComponentData, IQueryTypeParameter

Summary:
Component used by the game's ECS to store pollution-related coefficients for a network prefab. It contains a two-component vector (Unity.Mathematics.float2) named m_Factors. The exact semantic meaning of each component is determined by the systems that read this component in the game (for example, different pollution coefficients or factors affecting calculation and falloff). This type is blittable and safe to use in jobs and entity queries.


Fields

  • public Unity.Mathematics.float2 m_Factors
    Two-component vector holding pollution factors for the network prefab. Typically used as a pair of coefficients; interpretation depends on the consuming system. Initialize with a float2 value (e.g., new float2(1.0f, 0.0f)).

Properties

  • This type defines no properties. It exposes a single public field.

Constructors

  • public NetPollutionData()
    No explicit constructors are defined in source; the default parameterless constructor (provided by C# for structs) initializes m_Factors to float2.zero. You can create instances using object initializer syntax to set custom values.

Methods

  • This type defines no methods.

Usage Example

using Unity.Entities;
using Unity.Mathematics;
using Game.Prefabs;

// Create and add the component to an entity
var pollution = new NetPollutionData { m_Factors = new float2(1.0f, 0.5f) };
entityManager.AddComponentData(entity, pollution);

// Or query entities that have the NetPollutionData component
var query = entityManager.CreateEntityQuery(ComponentType.ReadOnly<NetPollutionData>());
using var chunks = query.ToArchetypeChunkArray(Unity.Collections.Allocator.TempJob);
// Iterate chunks and read m_Factors in a job or on main thread as needed.

Additional notes: - Because this is an IComponentData (plain struct) it is suitable for use in jobs and high-performance ECS code. - Include "using Unity.Mathematics;" when constructing or manipulating float2 values.