Game.Prefabs.UndergroundNetSections
Assembly:
Assembly-CSharp.dll
Namespace:
Game.Prefabs
Type:
class
Base:
ComponentBase
Summary:
Component used on Net geometry prefabs to reference a set of underground net sections. It holds an array of NetSectionInfo entries and participates in prefab dependency resolution by adding the referenced section prefabs to the dependency list. The class is decorated with a ComponentMenu attribute so it appears under "Net/" when creating components in the editor.
Fields
public NetSectionInfo[] m_Sections
Array of NetSectionInfo entries describing underground sections associated with this prefab. Each NetSectionInfo is expected to contain (at least) a reference to another prefab (m_Section). This field is used by GetDependencies to collect prefab dependencies.
Properties
- (none)
This component defines no properties.
Constructors
public UndergroundNetSections()
Default constructor. There is no custom initialization in the source; the array is expected to be populated by the prefab author in the editor or at prefab construction time.
Methods
public override void GetDependencies(List<PrefabBase> prefabs)
Scans the m_Sections array and adds each referenced section prefab (m_Section) to the provided prefabs list. This is used by the prefab build/pack system to ensure all dependent prefabs are included. Notes:- The implementation iterates over m_Sections with a standard for loop and calls prefabs.Add(m_Sections[i].m_Section).
-
There is no null-check in the source; in practice callers or authors should ensure m_Sections and each m_Sections[i].m_Section are not null to avoid NullReferenceException.
-
public override void GetPrefabComponents(HashSet<ComponentType> components)
Empty override. Intentionally does not add any ECS ComponentType entries to the prefab-level component set. This implies the prefab does not declare additional component types for entity creation at the prefab component stage. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Empty override. Intentionally does not add any ECS ComponentType entries to the archetype-level component set. This implies no extra archetype components are required when converting this prefab to an ECS archetype.
Usage Example
// Example usage in a prefab authoring script or editor customization
[ComponentMenu("Net/", new Type[] { typeof(NetGeometryPrefab) })]
public class UndergroundNetSections : ComponentBase
{
public NetSectionInfo[] m_Sections;
public override void GetDependencies(List<PrefabBase> prefabs)
{
base.GetDependencies(prefabs);
// This ensures each referenced section prefab is included in the dependency list
for (int i = 0; i < m_Sections.Length; i++)
{
prefabs.Add(m_Sections[i].m_Section);
}
}
}
Additional notes: - Because GetPrefabComponents and GetArchetypeComponents are empty, this component acts purely as a prefab data holder for traditional (non-ECS) prefab dependency resolution rather than contributing ECS components during conversion. - When adding section references in the editor, validate entries to prevent null references at runtime or during build processing.