// This method changes the current language.
    void ChangeLanguage(WordGameLanguage language)
    {
        // Abort all tasks before switching languages.
        // This is usually good practice.
        TaskManager.AbortAllTasksWaitForSeconds(10f);

        // Set the current language.
        WordGameLanguage.current = language;

        // Set the current language for the UI.
        m_ViewModel.languages.currentLanguage = language.languageName;

        // If a tile pool currently exists, destroy tiles to free up some memory.
        // Also remove the callback method from the tile pool.
        if (m_CurrentTilePool != null)
        {
            m_CurrentTilePool.DestroyAllTiles();
            m_CurrentTilePool.onTileDistribution -= OnTileDistribution;
        }

        // Sometimes, the language may already be loaded.
        // This usually happens when switching between scenes.
        m_ViewModel.languages.currentLanguageIsLoaded = WordGameLanguage.current.wordSet.isExpanded;
        if (m_ViewModel.languages.currentLanguageIsLoaded)
        {
            OnLanguageLoad();
        }
    }