Skip to content

Game.Prefabs.BiomePrefab

Assembly:
Assembly-CSharp

Namespace:
Game.Prefabs

Type:
class

Base:
PrefabBase

Summary:
Prefab component used to mark a Unity prefab so that, when converted to ECS, the resulting entity will include the BiomePrefabData component. The class appears in Unity's Add Component menu under "Diversity/" (via the ComponentMenu attribute). It overrides GetPrefabComponents to add ComponentType.ReadWrite(), while preserving the base prefab component set.


Fields

  • None
    This class declares no instance or static fields.

Properties

  • None
    No public or private properties are declared on this type.

Constructors

  • public BiomePrefab()
    Default parameterless constructor (inherited/implicit). In Unity this component is typically created/attached via the editor rather than constructed directly in code.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Overrides PrefabBase.GetPrefabComponents. Calls the base implementation to collect standard prefab components, then adds ComponentType.ReadWrite<BiomePrefabData>() to the provided set so converted entities will have the BiomePrefabData component (read/write access).

Usage Example

// Typical use: attach the BiomePrefab component to a GameObject prefab in the editor.
// During prefab-to-entity conversion, the conversion system will call GetPrefabComponents
// and ensure the entity has the BiomePrefabData component.

var components = new HashSet<Unity.Entities.ComponentType>();
var prefab = new Game.Prefabs.BiomePrefab();
// (In practice Unity manages MonoBehaviour lifecycle; calling this directly is illustrative.)
prefab.GetPrefabComponents(components);

// components now contains: ComponentType.ReadWrite<BiomePrefabData>()

Additional notes: - BiomePrefabData is expected to be an IComponentData (ECS component) representing biome-related data used by the game's systems. - The ComponentMenu attribute places this component under "Diversity/" in Unity's Add Component menu for easier assignment to prefabs.