Skip to content

Game.Prefabs.FeaturePrefab

Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs

Type: class

Base: PrefabBase

Summary:
FeaturePrefab is a simple prefab type used to mark prefabs that should include the FeatureData ECS component. It is decorated with a ComponentMenu attribute so it appears under "Features/" in the Unity component menu. When queried for its prefab components it adds ComponentType.ReadWrite() to the provided collection so that the resulting entity will include the FeatureData component.


Fields

  • None
    This class does not declare any fields.

Properties

  • None
    No public or private properties are declared by this class.

Constructors

  • public FeaturePrefab()
    Default constructor (inherited / implicit). No special construction logic is implemented in this class.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Overrides PrefabBase.GetPrefabComponents to contribute ECS component types for this prefab. Implementation details:
  • Calls base.GetPrefabComponents(components) to allow the base class to add its component types.
  • Adds ComponentType.ReadWrite<FeatureData>() to the supplied HashSet, indicating that entities created from this prefab should include the FeatureData component (read/write access).

Notes: - FeatureData should be an ECS component type (e.g., IComponentData/managed component) expected by game systems that operate on feature prefabs. - The method expects a mutable HashSet to which it appends component types; callers are typically prefab-handling code that aggregates required components before converting prefab GameObjects to entities.

Usage Example

// Example showing how a prefab handler might collect components from this prefab type:
var prefab = new Game.Prefabs.FeaturePrefab();
var components = new HashSet<ComponentType>();
prefab.GetPrefabComponents(components);

// After the call, components will contain ComponentType.ReadWrite<FeatureData>()
// and any component types added by the base implementation.

Additional information: - The class is annotated with [ComponentMenu("Features/", new Type[] { })], which places it in Unity's Add Component menu under the "Features" category for easier designer access. - This class is intentionally minimal: its sole responsibility is to advertise that prefabs of this type require FeatureData.