Game.Prefabs.UIAssetMenuPrefab
Assembly:
Assembly-CSharp (default game assembly)
Namespace:
Game.Prefabs
Type:
Class
Base:
UIGroupPrefab
Summary:
UIAssetMenuPrefab is a small prefab definition class used by the game's UI prefab system. It is annotated with [ComponentMenu("UI/", new Type[] { })] so it appears under the "UI" menu in editor tools. The class's only behavior is to augment the set of components that belong to this prefab by adding a read-write UIAssetMenuData component in addition to whatever components UIGroupPrefab already provides. This allows entities created from this prefab to include UIAssetMenuData for runtime use by UI systems.
Fields
- This class declares no instance fields.
UIAssetMenuPrefab only provides behavioral customization via an overridden method.
Properties
- This class declares no additional properties.
Constructors
public UIAssetMenuPrefab()
The class uses the default parameterless constructor (implicit). No special construction logic is implemented.
Methods
public override void GetPrefabComponents(HashSet<ComponentType> components)
Overrides the base implementation to collect all ComponentType entries required by this prefab. Implementation details:- Calls base.GetPrefabComponents(components) to include components defined by UIGroupPrefab.
- Adds ComponentType.ReadWrite
() to the provided HashSet, ensuring entities instantiated from this prefab will include the UIAssetMenuData component.
Remarks: - UIAssetMenuData must be a defined component type in the project. The method adds it as ReadWrite, indicating systems may mutate this component on entities created from the prefab. - The [ComponentMenu("UI/")] attribute places this prefab entry in the editor's UI menu for easier authoring.
Usage Example
// Example: collecting the components contributed by this prefab
var prefab = new UIAssetMenuPrefab();
var components = new HashSet<ComponentType>();
prefab.GetPrefabComponents(components);
// 'components' now contains the ComponentType entries from UIGroupPrefab
// and ComponentType.ReadWrite<UIAssetMenuData>() added by UIAssetMenuPrefab.