Class LocalizedAssetEvent<TObject, TReference, TEvent>
A version of LocalizedAssetBehaviour<TObject, TReference> which also includes a UnityEvent with the localized asset. Using the OnUpdateAsset event it is possible to Localize Components without writing scripts specific to the Component that can be configured in the Inspector.
Inheritance
Inherited Members
Namespace: UnityEngine.Localization.Components
Assembly: Unity.Localization.dll
Syntax
public class LocalizedAssetEvent<TObject, TReference, TEvent> : LocalizedAssetBehaviour<TObject, TReference> where TObject : Object where TReference : LocalizedAsset<TObject>, new() where TEvent : UnityEvent<TObject>, new()
Type Parameters
Name | Description |
---|---|
TObject | The type of Asset to be Localized. Must inherit from UnityEngine.Object |
TReference | The Serializable LocalizedAsset class. This will be used for the AssetReference property. |
TEvent | The Serializable UnityEvent that should be called when the asset is loaded. |
Examples
This example shows how a Font asset could be localized.
using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Localization;
using UnityEngine.Localization.Components;
[Serializable]
public class LocalizedFont : LocalizedAsset<Font> {}
[Serializable]
public class FontEvent : UnityEvent<Font> {}
public class LocalizedFontEventComponent : LocalizedAssetEvent<Font, LocalizedFont, FontEvent> {}
Properties
Name | Description |
---|---|
OnUpdateAsset | Unity Event that is invoked when the localized asset is updated. |
Methods
Name | Description |
---|---|
UpdateAsset(TObject) | Called when AssetReference has been loaded. This will occur when the game first starts after InitializationOperation has completed and whenever the SelectedLocale is changed. |