Game.Prefabs.BrandChirpPrefab
Assembly:
Assembly-CSharp (typical game assembly; adjust if packaged differently)
Namespace:
Game.Prefabs
Type:
class
Base:
ChirpPrefab
Summary:
Prefab class used to define a "BrandChirp" trigger prefab. It extends ChirpPrefab and contributes an additional ECS component type (BrandChirpData) to the prefab's component set by overriding GetPrefabComponents. The class is annotated with Unity's ComponentMenu attribute to control where it appears in Unity's component addition menu.
Fields
- (none)
This class declares no fields of its own.
Properties
- (none)
No properties are declared by this type.
Constructors
public BrandChirpPrefab()
No explicit constructor is declared in the source; the default parameterless constructor is provided by the compiler.
Methods
public override void GetPrefabComponents(HashSet<ComponentType> components)
Overrides the base implementation to add the BrandChirpData component type to the provided set. Implementation details:- Calls base.GetPrefabComponents(components) to include the component types declared by ChirpPrefab.
- Adds ComponentType.ReadWrite
() to the HashSet, indicating that this prefab requires read/write access to the BrandChirpData ECS component. - The HashSet parameter is modified in-place to include the required component types for entity conversion/creation.
Other notes: - The class is decorated with [ComponentMenu("Triggers/", new Type[] { })], which affects where it appears in the Unity Editor component menu (grouped under "Triggers/").
Usage Example
// Example: collect component types required by this prefab
var prefab = new BrandChirpPrefab();
var components = new HashSet<Unity.Entities.ComponentType>();
prefab.GetPrefabComponents(components);
// 'components' now contains ComponentType.ReadWrite<BrandChirpData>()
// plus whatever component types ChirpPrefab adds.
Additional tips:
- Ensure BrandChirpData is defined as an ECS component (IComponentData or similar) so ComponentType.ReadWrite