docs.unity3d.com
    Show / Hide Table of Contents

    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
    Object
    LocalizedMonoBehaviour
    LocalizedAssetBehaviour<TObject, TReference>
    LocalizedAssetEvent<TObject, TReference, TEvent>
    LocalizeAudioClipEvent
    LocalizedGameObjectEvent
    LocalizeSpriteEvent
    LocalizeTextureEvent
    Inherited Members
    LocalizedAssetBehaviour<TObject, TReference>.AssetReference
    LocalizedAssetBehaviour<TObject, TReference>.UpdateAsset(TObject)
    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 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

    OnUpdateAsset

    Unity Event that is invoked when the localized asset is updated.

    Declaration
    public TEvent OnUpdateAsset { get; set; }
    Property Value
    Type Description
    TEvent

    Methods

    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.

    Declaration
    protected override void UpdateAsset(TObject localizedAsset)
    Parameters
    Type Name Description
    TObject localizedAsset
    Overrides
    UnityEngine.Localization.Components.LocalizedAssetBehaviour<TObject, TReference>.UpdateAsset(TObject)
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023