docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TrackedUGuiDropdown

    Uses JSON to apply variant data to UnityEngine.UI.Dropdown. Calls UnityEngine.UI.Dropdown.RefreshShownValue() on the target object after applying changes.

    Inheritance
    object
    TrackedObject
    JsonSerializerTrackedObject
    TrackedUGuiDropdown
    Implements
    ISerializationCallbackReceiver
    Inherited Members
    JsonSerializerTrackedObject.UpdateType
    JsonSerializerTrackedObject.AddTrackedProperty(ITrackedProperty)
    JsonSerializerTrackedObject.ApplyLocale(Locale, Locale)
    TrackedObject.Target
    TrackedObject.TrackedProperties
    TrackedObject.CanTrackProperty(string)
    TrackedObject.AddTrackedProperty<T>(string)
    TrackedObject.RemoveTrackedProperty(ITrackedProperty)
    TrackedObject.GetTrackedProperty<T>(string, bool)
    TrackedObject.GetTrackedProperty(string)
    TrackedObject.CreateCustomTrackedProperty(string)
    Namespace: UnityEngine.Localization.PropertyVariants.TrackedObjects
    Assembly: Unity.Localization.dll
    Syntax
    [Serializable]
    [DisplayName("UI Dropdown", null)]
    [CustomTrackedObject(typeof(Dropdown), true)]
    public class TrackedUGuiDropdown : JsonSerializerTrackedObject, ISerializationCallbackReceiver
    Examples

    This shows how to configure a GameObjectLocalizer to apply changes to a Dropdown for the options values.

    public class SetupDropdown : MonoBehaviour
    {
        public Dropdown dropdown;
    
        void Start()
        {
            var localizer = gameObject.AddComponent<GameObjectLocalizer>();
    
            // Gets the Tracked text or creates a new tracker
            var trackedDropdown = localizer.GetTrackedObject<TrackedUGuiDropdown>(dropdown);
    
            // Setup each option
            for (int i = 0; i < dropdown.options.Count; ++i)
            {
                var optionText = trackedDropdown.GetTrackedProperty<LocalizedStringProperty>($"m_Options.m_Options.Array.data[{i}].m_Text");
                optionText.LocalizedString.SetReference("My String Table", "My Option " + i);
            }
    
            // Force an Update
            localizer.ApplyLocaleVariant(LocalizationSettings.SelectedLocale);
        }
    }

    Methods

    Name Description
    PostApplyTrackedProperties()

    Called when the variants have been applied to Target.

    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)