Skip to content

Game.Prefabs.UIResourceCategoryPrefab

Assembly:
Assembly-CSharp (inferred)

Namespace: Game.Prefabs

Type:
class

Base:
UIGroupPrefab

Summary:
A prefab class used to define a UI resource category in the game's UI prefab system. When collecting prefab component types, this prefab adds the UIResourceCategoryData component (as read/write) so that the ECS/world can create or attach that component for instances of this prefab. The class is marked with a ComponentMenu attribute to appear under "UI/" in the editor menus.


Fields

  • This type does not declare any private or public fields of its own. All state (if any) is inherited from its base types.

Properties

  • This type does not declare any properties.

Constructors

  • public UIResourceCategoryPrefab()
    Default parameterless constructor (compiler-generated). No custom construction logic is defined in this class.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Overrides the base implementation to append component types required by this prefab. Implementation details:
  • Calls the base.GetPrefabComponents(components) to include components defined by UIGroupPrefab and its ancestors.
  • Adds ComponentType.ReadWrite<UIResourceCategoryData>() to the provided HashSet, indicating that instances of this prefab require a read/write UIResourceCategoryData component.

Notes: - The method expects a HashSet of Unity.Entities.ComponentType; the addition ensures systems which instantiate or process prefabs will include the UIResourceCategoryData component for entities created from this prefab. - The class is annotated with [ComponentMenu("UI/", new Type[] { })], so it is intended to be discoverable in the editor UI under the "UI" menu.

Usage Example

// Example showing how the prefab reports its component types:
var prefab = new Game.Prefabs.UIResourceCategoryPrefab();
var components = new HashSet<Unity.Entities.ComponentType>();
prefab.GetPrefabComponents(components);

// After the call, components will contain UIResourceCategoryData as ReadWrite:
bool hasData = components.Contains(Unity.Entities.ComponentType.ReadWrite<UIResourceCategoryData>());

Additional modding notes: - Ensure the UIResourceCategoryData component type exists in your mod or the base game; otherwise adding its ComponentType will be invalid. - If you need to extend the prefab to include more component types, override GetPrefabComponents and add them similarly, while preserving the base call to include inherited components.