I have a few questions:
-
I would like to display the LocalizedString key at the top and on the list after changing the LocalizedString property field. I can only do this by selecting an item from the list again. I need something like “RegisterValueChangedCallback” to change it immediately.
-
Unity 2022.2. Is it still the only way to create LocalizedString field for a custom editor in UIToolkit?
My code:
SerializedProperty serializedProperty;
SerializedProperty serializedProperty2;
VisualElement CreateLocalizedString(SerializedObject so, SerializedProperty property, string propertyPath)
{
property = so.FindProperty(propertyPath);
return new IMGUIContainer(() =>
{
so.Update();
EditorGUILayout.PropertyField(property);
so.ApplyModifiedProperties();
});
}
private void OnItemSelection(IEnumerable<object> selectedItems)
{
activeItem = (Item)selectedItems.First();
SerializedObject so = new(activeItem);
detailSection.Bind(so);
itemName.text = activeItem.ObjectName.IsEmpty ? "" : GetKey(activeItem.ObjectName);
if (activeItem.Icon != null)
{
itemIcon.style.backgroundImage = activeItem.Icon.texture;
}
if (objectName != null)
{
detailSection.Remove(objectName);
}
if (description != null)
{
detailSection.Remove(description);
}
objectName = CreateLocalizedString(so, serializedProperty, "ObjectName");
description = CreateLocalizedString(so, serializedProperty2, "Description");
detailSection.Add(objectName);
detailSection.Add(description);
detailSection.style.visibility = Visibility.Visible;
}
- Is it possible to set the “Active Locale” (Window/Asset Management/Localization Scene Controls) in the script? If so how?

