Skip to content

Commit 798e8f7

Browse files
author
Unity Technologies
committed
Unity 2022.1.4f1 C# reference source code
1 parent ca9aafa commit 798e8f7

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

Editor/Mono/PlayModeView/PlayModeView.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,15 @@ protected string GetWindowTitle(Type type)
263263
return attributes.Length > 0 ? ((EditorWindowTitleAttribute)attributes[0]).title : type.Name;
264264
}
265265

266+
protected static string GetLocalizedWindowTitle(Type type)
267+
{
268+
var attributes = type.GetCustomAttributes(typeof(EditorWindowTitleAttribute), true);
269+
return attributes.Length > 0 ? EditorGUIUtility.TrTextContent(((EditorWindowTitleAttribute)attributes[0]).title).text : type.Name;
270+
}
271+
266272
protected Dictionary<Type, string> GetAvailableWindowTypes()
267273
{
268-
return m_AvailableWindowTypes ?? (m_AvailableWindowTypes = TypeCache.GetTypesDerivedFrom(typeof(PlayModeView)).OrderBy(GetWindowTitle).ToDictionary(t => t, GetWindowTitle));
274+
return m_AvailableWindowTypes ?? (m_AvailableWindowTypes = TypeCache.GetTypesDerivedFrom(typeof(PlayModeView)).OrderBy(GetWindowTitle).ToDictionary(t => t, GetLocalizedWindowTitle));
269275
}
270276

271277
private void SetSerializedViews(Dictionary<string, string> serializedViews)

Modules/DeviceSimulatorEditor/SimulatorWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void OnEnable()
5858
private void InitPlayModeViewSwapMenu()
5959
{
6060
var playModeViewTypeMenu = rootVisualElement.Q<ToolbarMenu>("playmode-view-menu");
61-
playModeViewTypeMenu.text = GetWindowTitle(GetType());
61+
playModeViewTypeMenu.text = GetLocalizedWindowTitle(GetType());
6262

6363
var types = GetAvailableWindowTypes();
6464
foreach (var type in types)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Unity 2022.1.3f1 C# reference source code
1+
## Unity 2022.1.4f1 C# reference source code
22

33
The C# part of the Unity engine and editor source code.
44
May be used for reference purposes only.

0 commit comments

Comments
 (0)