Game.Prefabs.UIWhatsNewPanelPrefab
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: PrefabBase
Summary:
Prefab class that defines the "What's New" UI panel used by the game. It contains serializable nested types to describe pages, page items and images for the panel. The prefab registers a runtime ECS component (UIWhatsNewPanelPrefabData) required by the game and performs late initialization to set the DLC id on that component using the prefab's DlcRequirement. The class is decorated with ComponentMenu("UI/") so it appears under the UI section in the editor.
Fields
public UIWhatsNewPanelPage[] m_Pages
Array of pages shown in the "What's New" panel. Each page contains one or more UIWhatsNewPanelPageItem entries which describe content blocks on the page.
Nested types and their fields:
public class UIWhatsNewPanelPage
-
public UIWhatsNewPanelPageItem[] m_Items
Items composing a page (serializable). -
public class UIWhatsNewPanelPageItem
public UIWhatsNewPanelImage[] m_Images
Images associated with this page item.[CanBeNull] public string m_TitleId
Localization key / id for the title (nullable).[CanBeNull] public string m_SubTitleId
Localization key / id for the subtitle (nullable).[CanBeNull] public string m_ParagraphsId
Localization key / id for paragraphs/body text (nullable).public Justify m_Justify
Alignment for text/content. Enum values: Left, Center, Right.-
[Range(25f, 100f)] public int m_Width = 100
Percentage of total width this item should use (25–100). Tooltip: "The percentage of the total width this item should use." -
public class UIWhatsNewPanelImage
[NotNull] public string m_Uri
URI to the image asset (non-null).public int2 m_AspectRatio
Aspect ratio for the image (Unity.Mathematics.int2).[Range(10f, 100f)] public int m_Width = 100
Percentage of total width this image should use (10–100). Tooltip: "The percentage of the total width this image should use."
Attributes used on the nested types and fields: [Serializable], [CanBeNull], [NotNull], [Range], [Tooltip].
Properties
- None declared on this type.
This prefab relies on public fields for serialized data and uses ECS component data (UIWhatsNewPanelPrefabData) at runtime.
Constructors
public UIWhatsNewPanelPrefab()
Default constructor (implicit). Initialization is handled via Unity/Unity Editor serialization and by the PrefabBase lifecycle methods.
Methods
public override void GetPrefabComponents(HashSet<ComponentType> prefabComponents)
Registers ECS component types required by this prefab. Implementation calls base.GetPrefabComponents(prefabComponents) and then adds a read/write ComponentType for UIWhatsNewPanelPrefabData:-
Adds ComponentType.ReadWrite
(). -
public override void LateInitialize(EntityManager entityManager, Entity entity)
Performs late initialization on the created entity for this prefab. Behavior: - Calls base.LateInitialize(entityManager, entity).
- Reads UIWhatsNewPanelPrefabData from the entity.
- Retrieves the DlcRequirement component from the source prefab (base.prefab.GetComponent
()). - Sets componentData.m_Id to the prefab's DLC id (component.m_Dlc.id).
- Writes the updated componentData back to the entity via entityManager.SetComponentData(entity, componentData). This ensures the runtime ECS component contains the correct DLC association for the UI panel.
Usage Example
// Typical LateInitialize override that sets the DLC id on the prefab's ECS component
public override void LateInitialize(EntityManager entityManager, Entity entity)
{
base.LateInitialize(entityManager, entity);
UIWhatsNewPanelPrefabData componentData = entityManager.GetComponentData<UIWhatsNewPanelPrefabData>(entity);
DlcRequirement component = base.prefab.GetComponent<DlcRequirement>();
componentData.m_Id = component.m_Dlc.id;
entityManager.SetComponentData(entity, componentData);
}
Notes and tips for modders: - Populate m_Pages with UIWhatsNewPanelPage objects in the prefab inspector; each page's items and images define the layout and content. - The string fields (m_TitleId, m_SubTitleId, m_ParagraphsId) are intended to be localization keys — supply entries in the game's localization tables. - The prefab registers UIWhatsNewPanelPrefabData on the entity; ensure systems that read this component expect the m_Id to reflect the DLC id set in LateInitialize.