Game.Prefabs.EarlyDisasterWarningEvent
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
A prefab component used to mark a prefab as an "early disaster warning" event. When the prefab is converted into an entity, this component contributes the EarlyDisasterWarningEventData component type (read/write) to the prefab's entity components. The class itself contains no runtime fields or extra archetype-only components; it simply declares which component type the prefab should include.
Fields
- (none)
This class does not declare any instance fields.
Properties
- (none)
No properties are declared on this type.
Constructors
- (implicit)
public EarlyDisasterWarningEvent()
No explicit constructors are declared; the default parameterless constructor is provided by the compiler.
Methods
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds the component type required on entities created from this prefab:- Calls
components.Add(ComponentType.ReadWrite<EarlyDisasterWarningEventData>());
-
Purpose: ensure entities created from the prefab include the EarlyDisasterWarningEventData component with read/write access.
-
public override void GetArchetypeComponents(HashSet<ComponentType> components)
No archetype-only components are added by this implementation; the method body is empty.
Usage Example
using System;
using System.Collections.Generic;
using Unity.Entities;
namespace Game.Prefabs
{
[ComponentMenu("Events/", new Type[] { typeof(EventPrefab) })]
public class EarlyDisasterWarningEvent : ComponentBase
{
public override void GetPrefabComponents(HashSet<ComponentType> components)
{
// Ensure the prefab's entity includes EarlyDisasterWarningEventData
components.Add(ComponentType.ReadWrite<EarlyDisasterWarningEventData>());
}
public override void GetArchetypeComponents(HashSet<ComponentType> components)
{
// No archetype-only components required
}
}
}
Additional notes: - Related type: EarlyDisasterWarningEventData — this is the ECS data component expected to exist on entities spawned from prefabs carrying this marker. - The class is annotated with [ComponentMenu("Events/", typeof(EventPrefab))], indicating it appears under Events in Unity's component menu for prefabs.