Skip to content

Game.Prefabs.OverheadNetSections

Assembly: Assembly-CSharp (likely)
Namespace: Game.Prefabs

Type: class (public)

Base: ComponentBase

Summary:
Component prefab that groups overhead net section prefabs. Holds an array of NetSectionInfo entries and exposes dependency resolution logic by adding each referenced section prefab to a provided prefab dependency list. Marked with a ComponentMenu attribute so it appears under the "Net/" menu in the editor.


Fields

  • public NetSectionInfo[] m_Sections
    Array of NetSectionInfo entries this prefab references. Each element's m_Section (a PrefabBase) is added to dependency lists by GetDependencies. Note: m_Sections may be null or empty — callers should account for that when iterating.

Properties

  • None declared in this class.

Constructors

  • public OverheadNetSections()
    Default parameterless constructor (compiler-generated if not present). No custom initialization in the source file.

Methods

  • public override void GetDependencies(List<PrefabBase> prefabs)
    Iterates m_Sections and adds each referenced section prefab (m_Section) to the provided prefabs list. Calls base.GetDependencies(prefabs) first. Be aware that m_Sections is accessed without null checks in the implementation; consider guarding against null when constructing or editing instances.

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Empty override. No prefab-level components are added by this class.

  • public override void GetArchetypeComponents(HashSet<ComponentType> components)
    Empty override. No archetype-level components are added by this class.

Usage Example

// Example: creating and populating an OverheadNetSections instance,
// and collecting its dependencies into a list.
var overhead = new OverheadNetSections
{
    m_Sections = new NetSectionInfo[]
    {
        new NetSectionInfo { m_Section = someSectionPrefab },
        new NetSectionInfo { m_Section = anotherSectionPrefab }
    }
};

var deps = new List<PrefabBase>();
overhead.GetDependencies(deps);

// deps now contains the referenced section prefabs.

{{ Additional notes: - Attribute [ComponentMenu("Net/", typeof(NetGeometryPrefab))] places this component in the "Net/" menu and associates it with NetGeometryPrefab in the editor. - If you extend this component, consider implementing GetPrefabComponents/GetArchetypeComponents to declare required ECS components. - If m_Sections may be modified at runtime or from user data, add null checks before iterating to avoid NullReferenceException. }}