Skip to content

Game.UI.UIEconomyConfigurationPrefab

Assembly:
Namespace: Game.UI

Type: class

Base: PrefabBase

Summary:
Prefab class used to define the economy configuration UI. Exposes arrays of budget items for income and expenses that are intended to be configured in the Unity inspector. When the prefab's components are collected (e.g., when converting a prefab to ECS), this class ensures the UIEconomyConfigurationData component is included on the resulting entity. The class is decorated with a ComponentMenu attribute so it appears under "Settings/" in the Unity component menu.


Fields

  • public BudgetItem<IncomeSource>[] m_IncomeItems
    Array of budget items representing income sources shown in the economy UI. Populate this in the prefab to define which income categories should appear and how they are presented.

  • public BudgetItem<ExpenseSource>[] m_ExpenseItems
    Array of budget items representing expense sources shown in the economy UI. Populate this in the prefab to define which expense categories should appear and how they are presented.

Properties

This type does not declare any properties.

Constructors

  • public UIEconomyConfigurationPrefab()
    Implicit default constructor. Instances are typically created/edited as Unity prefabs and configured in the editor rather than constructed at runtime.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Adds required ECS component types for this prefab to the provided set. Implementation calls the base PrefabBase.GetPrefabComponents(components) and then adds ComponentType.ReadWrite() so that entities created from this prefab will include the UIEconomyConfigurationData component.

Additional notes: - The method ensures the prefab will provide read/write access to UIEconomyConfigurationData in the entity/component-snapshot used by the game's ECS conversion. - It relies on the ComponentType helper from Unity.Entities to indicate the component access type.

Usage Example

// Typical usage: configure the prefab in the Unity inspector.
// Example of creating/configuring the object in code (for tooling/tests):

var prefab = new UIEconomyConfigurationPrefab();

// Example initialization — actual BudgetItem/Source types will have their own fields to fill.
prefab.m_IncomeItems = new[]
{
    new BudgetItem<IncomeSource> { /* set IncomeSource and display settings here */ }
};

prefab.m_ExpenseItems = new[]
{
    new BudgetItem<ExpenseSource> { /* set ExpenseSource and display settings here */ }
};

// When the prefab is converted to ECS, GetPrefabComponents will add
// ComponentType.ReadWrite<UIEconomyConfigurationData>() to the component set.