Skip to content

Game.Prefabs.Climate.WeatherData

Assembly:
Assembly-CSharp (Game) — found in the game's Game assembly file path: Game\Prefabs\Climate\WeatherData.cs

Namespace: Game.Prefabs.Climate

Type:
struct (value type)

Base:
Implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
WeatherData is an empty/tag ECS component (no fields) used to mark or identify entities related to the climate/weather system. The struct is decorated with StructLayout(LayoutKind.Sequential, Size = 1) to force a concrete non-zero size (1 byte) so it can be used efficiently as a component in Unity's ECS. Because it implements IQueryTypeParameter it can be used directly in entity queries and as a query type parameter. Typical usage is as a marker/storage-less component to tag entities that should be processed by weather/climate systems or systems that need to filter for weather-related entities.


Fields

  • None.
    This struct contains no fields; it is a marker/component tag. The [StructLayout(..., Size = 1)] attribute ensures the runtime allocates 1 byte for the struct so it can be used as a component in ECS.

Properties

  • None.
    There are no properties on this type. Use it solely as a tag component (add/remove or query by type).

Constructors

  • implicit default constructor
    The default parameterless constructor provided by C# applies. No explicit constructors are defined in the source.

Methods

  • None.
    There are no methods defined on this struct.

Usage Example

// Add WeatherData as a tag to an entity
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity weatherEntity = entityManager.CreateEntity();
entityManager.AddComponent<WeatherData>(weatherEntity);

// Query for entities that have the WeatherData tag
var query = entityManager.CreateEntityQuery(typeof(WeatherData));
using var entities = query.ToEntityArray(Allocator.Temp);
// process entities...

// Remove the tag when no longer needed
entityManager.RemoveComponent<WeatherData>(weatherEntity);

Additional notes: - Use WeatherData when you only need to mark entities; if you need to store values (temperature, precipitation, etc.) create a separate IComponentData struct with fields. - The StructLayout(Size = 1) pattern is common for marker components to ensure they occupy predictable memory and are valid for use as components in Unity DOTS systems. - Because it implements IQueryTypeParameter, WeatherData can be used in query type parameter APIs where supported by the Unity.Entities package.