Skip to content

Game.Prefabs.UIToolbarBottomConfigurationPrefab

Assembly: Game (inferred)
Namespace: Game.Prefabs

Type: class

Base: PrefabBase

Summary:
Prefab authoring class that provides configuration for the "bottom toolbar" UI, exposing trend threshold settings used by the UI (for example, money and population trend thresholds). It is decorated with a ComponentMenu attribute so it can be created/placed from the editor under the "Settings/" menu. During prefab/component registration it ensures the ECS component UIToolbarBottomConfigurationData is added to the prefab's component set so entity conversion systems will include that component.


Fields

  • public UITrendThresholds m_MoneyTrendThresholds
    Holds the trend threshold settings used to determine UI presentation for money trends (e.g., colors, thresholds, or states at different values). Intended to be configured in the prefab/inspector.

  • public UITrendThresholds m_PopulationTrendThresholds
    Holds the trend threshold settings used to determine UI presentation for population trends. Also intended to be configured in the prefab/inspector.

Properties

  • This class does not declare any properties.

Constructors

  • public UIToolbarBottomConfigurationPrefab()
    No explicit constructor is declared in the source file; the class uses the default parameterless constructor inherited from PrefabBase. Initialization of fields is expected to be done via the inspector or prefab asset.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Called to collect the set of ECS components that this prefab requires. Implementation calls the base PrefabBase.GetPrefabComponents(components) and then adds ComponentType.ReadWrite<UIToolbarBottomConfigurationData>() to the provided set. This instructs the prefab-to-entity conversion/prefab registration pipeline to attach the UIToolbarBottomConfigurationData component (read/write) to entities created from this prefab.

Parameters: - components: a HashSet of Unity.Entities.ComponentType that will be populated with the component types required by the prefab.

Behavior notes: - Ensure UIToolbarBottomConfigurationData exists and matches what systems expect at runtime. - The use of ReadWrite indicates the component will be used for both reading and writing by jobs/systems.

Usage Example

// Example of what the class does internally (showing the important override)
[ComponentMenu("Settings/", new Type[] { })]
public class UIToolbarBottomConfigurationPrefab : PrefabBase
{
    public UITrendThresholds m_MoneyTrendThresholds;
    public UITrendThresholds m_PopulationTrendThresholds;

    public override void GetPrefabComponents(HashSet<ComponentType> components)
    {
        base.GetPrefabComponents(components);
        // Ensure the ECS component for this UI configuration is added to the prefab
        components.Add(ComponentType.ReadWrite<UIToolbarBottomConfigurationData>());
    }
}

Additional notes: - The ComponentMenu attribute places this prefab authoring component under the "Settings/" menu in the editor, making it easier to create/configure in the project. - UITrendThresholds is expected to be a serializable type used by the UI to determine how to display trend information; configure those fields in the prefab asset. - The added ECS component (UIToolbarBottomConfigurationData) should contain data that conversion systems copy from this prefab's serialized fields into runtime entity components.