Skip to content

Game.Prefabs.MasterArea

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

Type: class

Base: ComponentBase

Summary:
Component used on area-related prefabs to designate a "master" area that controls one or more slave areas. The component exposes an array of SlaveAreaInfo entries which reference other area prefabs; those referenced prefabs are added as dependencies when the prefab system gathers dependencies. This component also declares that the prefab requires the SubArea component in both prefab component lists and ECS archetype component lists. The component is decorated with a ComponentMenu attribute so it appears under "Areas/" in the editor and is associated with AreaPrefab.


Fields

  • public SlaveAreaInfo[] m_SlaveAreas
    Array of slave-area entries. Each SlaveAreaInfo is expected to contain a reference (m_Area) to an AreaPrefab. GetDependencies iterates this array and adds each referenced area prefab to the provided dependency list. The array and its elements should be configured (not null) to avoid missing dependencies.

Properties

  • public override bool ignoreUnlockDependencies { get; }
    Always returns true. This override indicates that unlock dependencies should be ignored for this component/prefab (the prefab will not participate in the normal unlock-dependency checks).

Constructors

  • public MasterArea()
    No explicit constructor is defined in source; the default parameterless constructor is provided by the compiler/Unity runtime. The component is intended to be used/initialized via the Unity editor or prefab creation workflows.

Methods

  • public override void GetDependencies(System.Collections.Generic.List<PrefabBase> prefabs)
    Collects prefab dependencies. Calls the base implementation, then iterates m_SlaveAreas and adds each m_Area to the provided prefabs list. Note: the implementation assumes m_SlaveAreas and each m_Area are non-null; callers/creators should ensure the array is populated.

  • public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
    Adds ComponentType.ReadWrite<SubArea>() to the components set so the prefab will include the SubArea component in its prefab component list.

  • public override void GetArchetypeComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
    Adds ComponentType.ReadWrite<Game.Areas.SubArea>() to the components set so the ECS entity archetype will include the Game.Areas.SubArea component.

Usage Example

// Example: configuring a MasterArea instance on a prefab (runtime or via editor script)
var master = prefab.GetComponent<Game.Prefabs.MasterArea>();
master.m_SlaveAreas = new SlaveAreaInfo[]
{
    new SlaveAreaInfo { m_Area = someAreaPrefab },
    new SlaveAreaInfo { m_Area = anotherAreaPrefab }
};

// When the prefab system calls GetDependencies(prefabs),
// the referenced area prefabs will be added to the prefabs list.