Skip to content

Game.Prefabs.Climate.SeasonPrefab

Assembly: Game (inferred from project path; may be Assembly-CSharp in Unity projects)
Namespace: Game.Prefabs.Climate

Type: class

Base: PrefabBase

Summary:
SeasonPrefab is a small prefab helper class used to ensure that any entity created from the associated prefab receives a SeasonData component. It is decorated with a ComponentMenu attribute ("Weather/") so it can be placed/selected via the component menu in the editor. The class overrides GetPrefabComponents to add ComponentType.ReadWrite() to the prefab's component set, marking the prefab as possessing season/climate data at runtime.


Fields

  • None
    No private or public fields are declared in this class. The class only provides behavior via an overridden method.

Properties

  • None
    This class does not declare any properties.

Constructors

  • public SeasonPrefab()
    Implicit parameterless constructor (not explicitly declared in source). As a public class deriving from PrefabBase, a default constructor exists and will be used by Unity/serialization when needed.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Overrides PrefabBase.GetPrefabComponents. Implementation:
  • Calls base.GetPrefabComponents(components) to inherit any base prefab component registration.
  • Adds ComponentType.ReadWrite<SeasonData>() to the provided set so entities created from this prefab will include a SeasonData component (read/write).

Notes: - The method expects a HashSet of Unity.Entities.ComponentType and modifies it in-place. - SeasonData is the component type attached/registered by this prefab; it represents the per-entity seasonal/climate state (definition/details of SeasonData are defined elsewhere).

Usage Example

[ComponentMenu("Weather/", new Type[] { })]
public class SeasonPrefab : PrefabBase
{
    public override void GetPrefabComponents(HashSet<ComponentType> components)
    {
        base.GetPrefabComponents(components);
        components.Add(ComponentType.ReadWrite<SeasonData>());
    }
}

Example runtime effect: - When the prefab system converts this prefab into an ECS entity, the resulting entity will include a SeasonData component. Systems that process seasons/climate can then read/write that component on entities produced from this prefab.