Skip to content

Commit 5c849fb

Browse files
author
Unity Technologies
committed
Unity 2023.1.0a12 C# reference source code
1 parent e0297ce commit 5c849fb

32 files changed

Lines changed: 248 additions & 161 deletions

File tree

Editor/Mono/BuildPipeline/NamedBuildTarget.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ public static NamedBuildTarget FromBuildTargetGroup(BuildTargetGroup buildTarget
108108
return NamedBuildTarget.QNX;
109109

110110
// Build targets that are not explicitly listed
111-
case BuildTargetGroup.Lumin:
112-
return new NamedBuildTarget("Lumin");
113111
case BuildTargetGroup.GameCoreXboxSeries:
114112
return new NamedBuildTarget("GameCoreScarlett");
115113
case BuildTargetGroup.GameCoreXboxOne:

Editor/Mono/BuildTarget.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public enum BuildTarget
118118

119119
Switch = 38,
120120

121+
[System.Obsolete("Lumin has been removed in 2022.2")]
121122
Lumin = 39,
122123

123124
Stadia = 40,

Editor/Mono/BuildTargetConverter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ internal static class BuildTargetConverter
4242
return RuntimePlatform.tvOS;
4343
case BuildTarget.WebGL:
4444
return RuntimePlatform.WebGLPlayer;
45-
case BuildTarget.Lumin:
46-
return RuntimePlatform.Lumin;
4745
case BuildTarget.GameCoreXboxSeries:
4846
return RuntimePlatform.GameCoreXboxSeries;
4947
case BuildTarget.GameCoreXboxOne:

Editor/Mono/BuildTargetGroup.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public enum BuildTargetGroup
9595

9696
Switch = 27,
9797

98+
[Obsolete("Lumin has been removed in 2022.2")]
9899
Lumin = 28,
99100

100101
Stadia = 29,

Editor/Mono/PlayerSettings.bindings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ internal enum TextureCompressionFormat
256256
ASTC = 3,
257257
PVRTC = 4,
258258
DXTC = 5,
259-
BPTC = 6
259+
BPTC = 6,
260+
DXTC_RGTC = 7
260261
}
261262

262263
public enum InsecureHttpOption

Editor/Mono/Scripting/ScriptCompilation/CustomScriptAssembly.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ static CustomScriptAssembly()
321321
new CustomScriptAssemblyPlatform("PSVita", BuildTarget.PSP2),
322322
new CustomScriptAssemblyPlatform("LinuxStandalone32", BuildTarget.StandaloneLinux),
323323
new CustomScriptAssemblyPlatform("LinuxStandaloneUniversal", BuildTarget.StandaloneLinuxUniversal),
324+
new CustomScriptAssemblyPlatform("Lumin", BuildTarget.Lumin),
324325
};
325326
#pragma warning restore 0618
326327
}

Editor/Mono/Settings/SettingsWindow.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,21 @@ private static class Styles
4848
public static StyleBlock window => EditorResources.GetStyle("sb-settings-window");
4949
public static StyleBlock settingsPanel => EditorResources.GetStyle("sb-settings-panel-client-area");
5050
public static StyleBlock header => EditorResources.GetStyle("sb-settings-header");
51+
52+
// FIXME: the highlight mesh is drawn *over* the text, hiding it. We have to reduce the alpha value of the highlight color
53+
// in order to make the text readable. Blocked by jira https://jira.unity3d.com/browse/UUM-9296
54+
private static float s_HighlightColorAlpha = 0.67f;
55+
56+
private static string s_SelectionColorTag = null;
57+
public static string SelectionColorTag => s_SelectionColorTag ??
58+
(s_SelectionColorTag = $"<mark=#{ColorUtility.ToHtmlStringRGBA(new Color(HighlightColor.r, HighlightColor.g, HighlightColor.b, s_HighlightColorAlpha))}>");
59+
public static readonly string SelectionColorEndTag = "</mark>";
60+
private static string s_TextColorTag = null;
61+
public static string TextColorTag => s_TextColorTag ?? (s_TextColorTag = $"<color=#{ColorUtility.ToHtmlStringRGBA(Styles.settingsPanel.GetColor("-unity-search-highlight-color"))}>");
62+
public static readonly string TextColorEndTag = "</color>";
63+
public static readonly System.Text.RegularExpressions.Regex TagRegex = new System.Text.RegularExpressions.Regex(@"<[^>]*>");
64+
65+
private static Color HighlightColor => Styles.settingsPanel.GetColor("-unity-search-highlight-selection-color");
5166
}
5267

5368
public static float s_DefaultLabelWidth => Styles.window.GetFloat("-unity-label-width");
@@ -303,6 +318,27 @@ private void SetupWindowPosition()
303318
}
304319
}
305320

321+
private static void UpdateSearchHighlight(VisualElement container, string searchText)
322+
{
323+
container.Query(null, "settings-panel").Descendents<Label>().ForEach((label) =>
324+
{
325+
var text = label.text;
326+
var hasHighlight = Styles.TagRegex.IsMatch(text);
327+
text = Styles.TagRegex.Replace(text, String.Empty);
328+
if (!SearchUtils.MatchSearchGroups(searchText, text, out var startHighlight, out var endHighlight))
329+
{
330+
if (hasHighlight)
331+
label.text = text;
332+
return;
333+
}
334+
335+
text = text.Insert(startHighlight, Styles.SelectionColorTag);
336+
text = text.Insert(endHighlight + Styles.SelectionColorTag.Length + 1, Styles.SelectionColorEndTag);
337+
text = $"{Styles.TextColorTag}{text}{Styles.TextColorEndTag}";
338+
label.text = text;
339+
});
340+
}
341+
306342
private void SetupUI()
307343
{
308344
SetupWindowPosition();
@@ -480,6 +516,7 @@ private void DrawTreeView()
480516
private void HandleSearchFiltering()
481517
{
482518
m_TreeView.searchString = m_SearchText;
519+
UpdateSearchHighlight(m_SettingsPanel, m_SearchText);
483520
}
484521

485522
[MenuItem("Edit/Project Settings...", false, 259, false)]

Editor/Mono/UIElements/DefaultMainToolbar.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ static IEnumerable<string> middleToolbar
2424
{
2525
get
2626
{
27+
// Modules/EditorToolbar/ToolbarElements/PlayModeButtons.cs
2728
yield return "Editor Utility/Play Mode";
2829
}
2930
}
@@ -32,6 +33,7 @@ static IEnumerable<string> rightToolbar
3233
{
3334
get
3435
{
36+
// Modules/EditorToolbar/ToolbarElements/*.cs
3537
yield return "Editor Utility/Layout";
3638
yield return "Editor Utility/Layers";
3739
yield return "Editor Utility/Search";

Modules/AssetDatabase/Editor/ScriptBindings/AssetDatabase.bindings.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ public static bool DeleteAssets(string[] paths, List<string> outFailedPaths)
256256
[uei.ExcludeFromDocs] public static void ImportAsset(string path) { ImportAsset(path, ImportAssetOptions.Default); }
257257
extern public static void ImportAsset(string path, [uei.DefaultValue("ImportAssetOptions.Default")] ImportAssetOptions options);
258258
extern public static bool CopyAsset(string path, string newPath);
259+
[NativeThrows]
260+
[PreventExecutionInState(AssetDatabasePreventExecution.kImportingAsset, PreventExecutionSeverity.PreventExecution_ManagedException, "Assets may not be copied during AssetImporting as this leads to new asset creation in the middle of an import.")]
261+
[PreventExecutionInState(AssetDatabasePreventExecution.kImportingInWorkerProcess, PreventExecutionSeverity.PreventExecution_ManagedException, "Assets may not be copied during AssetImporting as this leads to new asset creation in the middle of an import.")]
262+
extern public static bool CopyAssets(string[] paths, string[] newPaths);
259263
extern public static bool WriteImportSettingsIfDirty(string path);
260264
[NativeThrows]
261265
extern public static string[] GetSubFolders([NotNull] string path);
@@ -1068,5 +1072,25 @@ internal struct WorkerStats
10681072
}
10691073

10701074
internal extern static WorkerStats GetWorkerStats();
1075+
1076+
// Binding only created for testing
1077+
internal static int TestOnlyDeleteAllNonPrimaryArtifacts(Type[] importers, bool deleteUnusedContentFiles)
1078+
{
1079+
return DeleteAllNonPrimaryArtifacts_Importer(importers, deleteUnusedContentFiles);
1080+
}
1081+
1082+
private extern static int DeleteAllNonPrimaryArtifacts_Importer(Type[] importers, bool deleteUnusedContentFiles);
1083+
1084+
// Binding only created for testing
1085+
internal static int TestOnlyDeleteAllNonPrimaryArtifacts(ArtifactKey[] artifactKeys, bool deleteUnusedContentFiles)
1086+
{
1087+
return DeleteAllNonPrimaryArtifacts_ArtifactKey(artifactKeys, deleteUnusedContentFiles);
1088+
}
1089+
1090+
private extern static int DeleteAllNonPrimaryArtifacts_ArtifactKey(ArtifactKey[] artifactKeys, bool deleteUnusedContentFiles);
1091+
1092+
// Binding only created for testing
1093+
[FreeFunction("AssetDatabase::DeleteUnusedContentFiles")]
1094+
internal extern static void TestOnlyDeleteUnusedContentFiles();
10711095
}
10721096
}

Modules/AssetPipelineEditor/ImportSettings/AssetImporterEditor.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,10 @@ static void ImportAssets(IEnumerable<string> paths)
576576
}
577577
AssetDatabase.StartAssetEditing();
578578
foreach (string path in paths)
579-
AssetDatabase.ImportAsset(path);
579+
{
580+
if(File.Exists(path))
581+
AssetDatabase.ImportAsset(path);
582+
}
580583
AssetDatabase.StopAssetEditing();
581584
}
582585

0 commit comments

Comments
 (0)