logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class LeaderboardPanelPlacementApplier

    Applies authored LeaderboardElementPlacements onto a leaderboard panel's element rects, pulling each element out of the panel's stacking layout so it renders wherever it was placed. Stateless and idempotent: every call fully re-derives its result from its own inputs, so re-applying the same placements (e.g. once after SetRows rebuilds the rows, once after the rows table's own scroll-shell extent catches up) yields the same rects.

    Inheritance
    object
    LeaderboardPanelPlacementApplier
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Leaderboard.Infrastructure.Views
    Assembly: Serenity.UnityLeaderboard.Infrastructure.dll
    Syntax
    public static class LeaderboardPanelPlacementApplier
    Remarks

    Trade-off: disabling the root's UnityEngine.UI.VerticalLayoutGroup/UnityEngine.UI.ContentSizeFitter changes the frame a placement's offset is measured in — from "stacked position after the layout group ran" to "anchor of the panel's own full-stretch rect". The Leaderboard View Designer previews placements through this exact class so its preview never drifts from what plays at runtime.

    A target's own UnityEngine.UI.ContentSizeFitter (the rows container carries one, sized to its content) is left alone on any axis the placement leaves at 0 (shrink-wrap), but switched to UnityEngine.UI.ContentSizeFitter.FitMode.Unconstrained on every axis the placement authors a size for — otherwise the fitter's next layout pass would silently overwrite the authored sizeDelta right back to its content size.

    Hidden only ever deactivates: a placement with Hidden == false leaves the target's current active state alone rather than reactivating it, because SetActive is also how UnityLeaderboardPanel.SetTitle/SetEmptyState hide an empty title or a non-empty board — unconditionally un-hiding here would fight those calls depending on which ran last. This is safe because nothing un-hides a placement at runtime: the panel is built fresh at install, and the designer preview rebuilds the panel per render.

    Methods

    Apply(RectTransform, IReadOnlyList<ElementTarget>, IReadOnlyList<LeaderboardElementPlacement>)

    Normalizes panelRoot to a plain full-stretch frame, then places every target whose element has an entry in placements. A null/empty placements leaves everything untouched — the panel's stacking layout stays exactly as built.

    Declaration
    public static void Apply(RectTransform panelRoot, IReadOnlyList<LeaderboardPanelPlacementApplier.ElementTarget> targets, IReadOnlyList<LeaderboardElementPlacement> placements)
    Parameters
    Type Name Description
    RectTransform panelRoot

    The panel's own RectTransform (carries the stacking layout group/fitter).

    IReadOnlyList<LeaderboardPanelPlacementApplier.ElementTarget> targets

    Each element this panel has a slot for, and the rect that slot resolves to.

    IReadOnlyList<LeaderboardElementPlacement> placements

    The authored (or default-filled) placement for every element.

    Apply(RectTransform, IReadOnlyList<PlacedElement>)

    Same contract as the LeaderboardPanelPlacementApplier.ElementTarget overload, for a caller that already pairs each rect with its own placement (a leaderboard view's authored LeaderboardViewButtons, which are matched by list order rather than by LeaderboardViewElement). A null/empty placed leaves the panel untouched — same as an empty placements above.

    Declaration
    public static void Apply(RectTransform panelRoot, IReadOnlyList<LeaderboardPanelPlacementApplier.PlacedElement> placed)
    Parameters
    Type Name Description
    RectTransform panelRoot

    The panel's own RectTransform (carries the stacking layout group/fitter).

    IReadOnlyList<LeaderboardPanelPlacementApplier.PlacedElement> placed

    Each rect to place, already paired with the placement to apply to it.

    In this article
    © 2026 Serenity. All Rights Reserved