private void Select(GameObject i_NewSelection)
    {
        if (i_NewSelection == null)
        {
            return;
        }

        // Release previous selection.

        {
            if (m_CurrentSelection != null)
            {
                tnUICreditsEntry creditsEntry = m_CurrentSelection.GetComponent <tnUICreditsEntry>();

                if (creditsEntry != null)
                {
                    creditsEntry.SetHighlighted(false);

                    // Play SFX.

                    if (m_OnNavigate != null)
                    {
                        m_OnNavigate.Invoke();
                    }
                }
            }
        }

        // Update new selection.

        {
            m_CurrentSelection = i_NewSelection;

            {
                tnUICreditsEntry creditsEntry = i_NewSelection.GetComponent <tnUICreditsEntry>();

                if (creditsEntry != null)
                {
                    creditsEntry.SetHighlighted(true);

                    // Refresh portrait.

                    int entryIndex = creditsEntry.index;
                    UpdatePortrait(entryIndex);
                }
            }
        }
    }
    // INTERNALS

    private void SetupPage()
    {
        if (m_Prefab == null)
        {
            return;
        }

        for (int anchorIndex = 0; anchorIndex < m_Anchors.Length; ++anchorIndex)
        {
            RectTransform anchor = m_Anchors[anchorIndex];

            if (anchor == null)
            {
                continue;
            }

            // Try to get a credits data entry.

            tnCreditsData creditsData = tnGameData.GetCreditsDataMain(anchorIndex);

            if (creditsData == null)
            {
                continue;
            }

            // Create credits entry.

            tnUICreditsEntry creditsEntry = Instantiate <tnUICreditsEntry>(m_Prefab);
            creditsEntry.transform.SetParent(anchor, false);

            // Configure entry.

            creditsEntry.SetIndex(anchorIndex);

            creditsEntry.SetBaseImage(creditsData.baseSprite);
            creditsEntry.SetCharacterAnimator(creditsData.animatorController);
            creditsEntry.SetCharacterName(creditsData.nickname);
            creditsEntry.SetRole(creditsData.role);

            creditsEntry.SetHighlighted(false);

            m_Entries.Add(creditsEntry);
        }
    }
    void OnEnable()
    {
        // Update players list from InputModule.

        {
            m_Players.Clear();

            InputModule inputModule = UIEventSystem.inputModuleMain;

            if (inputModule != null)
            {
                for (int playerIndex = 0; playerIndex < inputModule.playersCount; ++playerIndex)
                {
                    PlayerInput playerInput = inputModule.GetPlayerInput(playerIndex);
                    m_Players.Add(playerInput);
                }
            }
        }

        // Update wifi players list from InputModule.

        {
            m_WiFiPlayers.Clear();

            InputModule inputModule = UIEventSystem.inputModuleMain;

            if (inputModule != null)
            {
                for (int playerIndex = 0; playerIndex < inputModule.wifiPlayersCount; ++playerIndex)
                {
                    WiFiPlayerInput playerInput = inputModule.GetWifiPlayerInput(playerIndex);
                    m_WiFiPlayers.Add(playerInput);
                }
            }
        }

        // Clear slots.

        {
            for (int entryIndex = 0; entryIndex < m_Entries.Count; ++entryIndex)
            {
                tnUICreditsEntry entry = m_Entries[entryIndex];
                entry.SetHighlighted(false);
            }
        }

        // Clear portrait.

        {
            if (m_Portrait != null)
            {
                m_Portrait.Clear();
            }
        }

        // Find first available entry.

        GameObject firstEntry = null;

        {
            for (int entryIndex = 0; entryIndex < m_Entries.Count; ++entryIndex)
            {
                tnUICreditsEntry creditsEntry = m_Entries[entryIndex];

                if (creditsEntry != null)
                {
                    firstEntry = creditsEntry.gameObject;
                }
            }
        }

        // Update selection.

        {
            Select(firstEntry);
        }
    }