Game.Prefabs.AreaTypePrefab
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: PrefabBase
Summary:
Represents a prefab definition for an "area type" used by the game. This prefab holds a reference to the AreaType asset and the materials used to render the area and its name. When the prefab is processed for ECS (Entity Component System) conversion, it ensures that the AreaTypeData component is included in the prefab's component list so entities created from this prefab will carry the area-type data.
Fields
-
public AreaType m_Type
Holds a reference to the AreaType asset (custom game type defined in Game.Areas). This links the prefab to a semantic area classification used by the game logic (for example residential, commercial, park, etc.). -
public Material m_Material
Material used for rendering the area mesh/visuals in the scene. -
public Material m_NameMaterial
Material used specifically for rendering the area's name or label.
Properties
- This type defines no properties.
The class exposes only public fields for configuration; there are no C# properties declared.
Constructors
public AreaTypePrefab()
Default, parameterless constructor provided implicitly. The class does not define custom construction logic; initialization is typically done via the Unity editor by assigning the fields on the prefab asset.
Methods
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds required ECS component types for this prefab. Implementation details:- Calls base.GetPrefabComponents(components) to include common prefab components defined by PrefabBase.
- Adds ComponentType.ReadWrite
() to the supplied HashSet, ensuring the AreaTypeData component will be part of the prefab's entity archetype when converted to ECS entities.
Additional notes:
- The method expects a System.Collections.Generic.HashSet
Usage Example
// Example: Querying which components this prefab will add to an entity archetype
var prefab = /* reference to AreaTypePrefab asset from inspector or Resources */;
var components = new HashSet<Unity.Entities.ComponentType>();
prefab.GetPrefabComponents(components);
// components now contains ComponentType.ReadWrite<AreaTypeData>() plus any base components
foreach (var c in components)
{
Debug.Log("Prefab component: " + c);
}