Game.Prefabs.UIProductionLinks
Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
Component used on UI-related prefabs to declare production link relationships for the UI. Holds a reference to a producer UIProductionLinkPrefab and an optional array of final consumer link prefabs. Provides dependency reporting for prefab building and registers the runtime component type UIProductionLinksData required by instances of this prefab.
Fields
-
public UIProductionLinkPrefab m_Producer
Reference to the producer UIProductionLinkPrefab. If set, this prefab will be reported as a dependency by GetDependencies so it gets included when prefabs are gathered/built. -
public UIProductionLinkPrefab[] m_FinalConsumers
[CanBeNull] Optional array of final consumer link prefabs. Can be null or contain null elements. Non-null entries are reported as dependencies by GetDependencies.
Properties
- None (this class exposes only fields; there are no public properties defined)
Constructors
public UIProductionLinks()
Default parameterless constructor (inherited/implicit). No special initialization is performed by this class.
Methods
public override void GetDependencies(List<PrefabBase> prefabs)
Adds referenced prefabs to the provided list so they are included as dependencies. Implementation:- Calls base.GetDependencies(prefabs).
- If m_Producer is non-null, adds it to prefabs.
-
If m_FinalConsumers is non-null, iterates the array and adds each non-null element to prefabs. This ensures the linked UI production prefabs are known to the prefab system and included in build/load operations.
-
public override void GetPrefabComponents(HashSet<ComponentType> components)
Registers required ECS component types for prefab instances. This class adds ComponentType.ReadWrite(), indicating prefab instances require a read/write UIProductionLinksData component. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Empty implementation. No archetype-specific components are added here.
Usage Example
// Example of how the prefab might be set up and how dependencies are reported.
// This code demonstrates how GetDependencies will include the producer and consumers.
public class Example
{
public void CollectDependencies()
{
var prefabComponent = new UIProductionLinks();
prefabComponent.m_Producer = /* assign a UIProductionLinkPrefab reference */;
prefabComponent.m_FinalConsumers = new UIProductionLinkPrefab[]
{
/* assign consumer prefab references or leave null entries */
};
var dependencies = new List<PrefabBase>();
prefabComponent.GetDependencies(dependencies);
// 'dependencies' now contains the producer (if set) and any non-null final consumers.
}
}
Notes: - The [CanBeNull] annotation on m_FinalConsumers indicates callers should expect the array may be null. - The ComponentMenu attribute on the class (ComponentMenu("UI/", new Type[] { typeof(ResourcePrefab) })) places this component under the UI section in prefab editor menus. - The class ensures the runtime ECS component UIProductionLinksData is declared for prefab instances via GetPrefabComponents.