View Categories

On Language Change

Description

This UnityEvent automatically updates all the Loxis Localizer instances when a language change event is detected. You can also subscribe to this event.

Type

UnityEvent

Syntax

loxisManager.onLanguageChange.AddListener(someMethod); 

Example

using UnityEngine;
using AMACreative.Loxis;

public class LangaugeChangeTester : MonoBehavior

// Get reference to a LoxisManager instance through the inspector
[SerializeField] private LoxisManager loxisManager;

private void Start()
{
    loxisManager.onLanguageChange.AddListener(languageChangeHandler);
}

private void OnDestroy()
{
    loxisManager.onLanguageChange.RemoveListener(languageChangeHandler);
}

private void languageChangeHandler()
{
    if (loxisManager.currentLangauge == "English")
    {
        Debug.Log("It's English!");
    }
    else
    {
       Debug.Log("It's not English!"); 
    }
} 

Leave a Reply

Your email address will not be published. Required fields are marked *