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
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 |
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
OnUpdateAsset
Declaration
public TEvent OnUpdateAsset { get; set; }
Property Value
Type | Description |
---|---|
TEvent |
Methods
UpdateAsset(TObject)
Declaration
protected override void UpdateAsset(TObject localizedAsset)
Parameters
Type | Name | Description |
---|---|---|
TObject | localizedAsset |