Skip to content

Commit cc405f6

Browse files
author
Unity Technologies
committed
Unity 2023.3.0a12 C# reference source code
1 parent c005868 commit cc405f6

File tree

63 files changed

+1079
-334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1079
-334
lines changed

Editor/Mono/BuildPipeline/NamedBuildTarget.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace UnityEditor.Build
2222
"PS4",
2323
"XboxOne",
2424
"tvOS",
25-
"Bratwurst",
25+
"VisionOS",
2626
"Nintendo Switch",
2727
"Stadia",
2828
"CloudRendering",
@@ -48,7 +48,7 @@ namespace UnityEditor.Build
4848
public static readonly NamedBuildTarget PS5 = new NamedBuildTarget("PS5");
4949
public static readonly NamedBuildTarget XboxOne = new NamedBuildTarget("XboxOne");
5050
public static readonly NamedBuildTarget tvOS = new NamedBuildTarget("tvOS");
51-
public static readonly NamedBuildTarget Bratwurst = new NamedBuildTarget("Bratwurst");
51+
public static readonly NamedBuildTarget VisionOS = new NamedBuildTarget("VisionOS");
5252
public static readonly NamedBuildTarget NintendoSwitch = new NamedBuildTarget("Nintendo Switch");
5353
[System.Obsolete("Stadia has been removed in 2023.1")]
5454
public static readonly NamedBuildTarget Stadia = new NamedBuildTarget("Stadia");
@@ -103,8 +103,8 @@ public static NamedBuildTarget FromBuildTargetGroup(BuildTargetGroup buildTarget
103103
return NamedBuildTarget.XboxOne;
104104
case BuildTargetGroup.tvOS:
105105
return NamedBuildTarget.tvOS;
106-
case BuildTargetGroup.Bratwurst:
107-
return NamedBuildTarget.Bratwurst;
106+
case BuildTargetGroup.VisionOS:
107+
return NamedBuildTarget.VisionOS;
108108
case BuildTargetGroup.Switch:
109109
return NamedBuildTarget.NintendoSwitch;
110110
case BuildTargetGroup.LinuxHeadlessSimulation:

Editor/Mono/BuildProfile/BuildProfileContext.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using UnityEditor.Modules;
1010
using UnityEditorInternal;
1111
using UnityEngine;
12+
using UnityEngine.Bindings;
1213
using UnityEngine.Scripting;
1314

1415
namespace UnityEditor.Build.Profile
@@ -274,6 +275,19 @@ BuildProfile GetOrCreateClassicPlatformBuildProfile(BuildTarget target, Standalo
274275
// Only copy after adding to the build target -> classic profiles dictionary, so EditorUserBuildSettings
275276
// can access the classic profiles when copying the settings
276277
EditorUserBuildSettings.CopyToBuildProfile(buildProfile);
278+
279+
// Created profile can also be populated by settings on the managed side
280+
string module = BuildTargetDiscovery.GetModuleNameForBuildTarget(buildProfile.buildTarget);
281+
var extension = ModuleManager.GetBuildProfileExtension(module);
282+
if (extension != null)
283+
{
284+
extension.CopyPlatformSettingsToBuildProfile(buildProfile.platformBuildProfile);
285+
}
286+
else
287+
{
288+
Debug.LogError($"Build profile extension is null for module {module} and build profile {buildProfile.name}");
289+
}
290+
277291
SaveBuildProfileInProject(buildProfile);
278292

279293
return buildProfile;

Editor/Mono/BuildTarget.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public enum BuildTarget
140140

141141
QNX = 46,
142142

143-
Bratwurst = 47,
143+
VisionOS = 47,
144144

145145
// obsolete identifiers. We're using different values so that ToString() works.
146146
[System.Obsolete("Use iOS instead (UnityUpgradable) -> iOS", true)]

Editor/Mono/BuildTargetGroup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,6 @@ public enum BuildTargetGroup
116116

117117
QNX = 35,
118118

119-
Bratwurst = 36,
119+
VisionOS = 36,
120120
}
121121
}

Editor/Mono/CSPreProcess.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ static bool Run(bool includeModules)
2727
const int logIdentifierForUnityEditorCompilationMessages = 2345;
2828
UnityEngine.Debug.RemoveLogEntriesByIdentifier(logIdentifierForUnityEditorCompilationMessages);
2929
foreach (var message in messages)
30-
UnityEngine.Debug.LogCompilerMessage(message.message, message.file, message.line, message.column, true, message.type == CompilerMessageType.Error, logIdentifierForUnityEditorCompilationMessages);
30+
{
31+
UnityEngine.Debug.LogCompilerMessage(message.message, message.file, message.line, message.column, true, message.type == CompilerMessageType.Error, logIdentifierForUnityEditorCompilationMessages, 0);
32+
}
3133

3234
return exitcode == 0;
3335
}

Editor/Mono/ContextMenuUtility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ internal static void ShowActionMenu()
196196
if (dropdownMenu.MenuItems().Count == 0)
197197
AddAction(dropdownMenu, "No Actions for this Context", null, false);
198198

199-
dropdownMenu.DoDisplayEditorMenu(new Rect(Event.current.mousePosition, Vector2.zero));
199+
dropdownMenu.DisplayEditorMenu(new Rect(Event.current.mousePosition, Vector2.zero));
200200
}
201201

202202
static T[] ToArray<T>(IEnumerable<T> enumerable) where T : Object

Editor/Mono/EditorApplication.bindings.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,12 @@ internal static extern bool isPackageManagerDisabled
272272
get;
273273
}
274274

275+
public static extern bool isCreateFromTemplate
276+
{
277+
[FreeFunction("IsCreateFromTemplate")]
278+
get;
279+
}
280+
275281
internal static extern string userJavascriptPackagesPath
276282
{
277283
get;

Editor/Mono/EditorGraphicsSettings.bindings.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ public static IEnumerable<Type> GetSupportedRenderPipelineGraphicsSettingsTypesF
139139
yield return info.type;
140140
}
141141
}
142+
143+
public static void PopulateRenderPipelineGraphicsSettings(RenderPipelineGlobalSettings settings)
144+
{
145+
RenderPipelineGraphicsSettingsManager.PopulateRenderPipelineGraphicsSettings(settings);
146+
}
142147

143148
[NativeName("GraphicsSettingsCount")] static extern int Internal_GraphicsSettingsCount();
144149
[NativeName("GetSettingsForRenderPipelineAt")] static extern Object Internal_GetSettingsForRenderPipelineAt(int index);

Editor/Mono/GUI/MaskFieldGUI.cs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ private class MaskCallbackInfo
3333
// Which view should we send it to.
3434
private readonly GUIView m_SourceView;
3535

36+
// Current drop-down reference
37+
public MaskFieldDropDown m_DropDown;
38+
39+
// validation flag for masks that are changed externally
40+
private bool m_Validate = false;
41+
3642
public MaskCallbackInfo(int controlID)
3743
{
3844
m_ControlID = controlID;
@@ -77,6 +83,31 @@ internal void SetMaskValueDelegate(object userData, string[] options, int select
7783
if (m_SourceView)
7884
m_SourceView.SendEvent(EditorGUIUtility.CommandEvent(kMaskMenuChangedMessage));
7985
}
86+
87+
public void UpdateFlagChanges(int mask, int[] optionMaskValues)
88+
{
89+
var evt = Event.current;
90+
91+
if (evt.type == EventType.ExecuteCommand)
92+
{
93+
m_Validate = true;
94+
}
95+
// This code is responsible for verifying whether the incoming mask value differs from the one that is currently selected in the dropdown menu.
96+
// When these values do not match, it serves as confirmation that the incoming value has been modified.
97+
// Subsequently, we proceed to update the dropdown menu to reflect these changes.
98+
else if (evt.type == EventType.Repaint && m_Validate)
99+
{
100+
if (m_DropDown == null)
101+
{
102+
return;
103+
}
104+
105+
if (mask != m_NewMask)
106+
m_DropDown.UpdateMaskValues(mask, optionMaskValues);
107+
108+
m_Validate = false;
109+
}
110+
}
80111
}
81112

82113
/// Make a field for a generic mask.
@@ -117,6 +148,10 @@ internal static int DoMaskField(Rect position, int controlID, int mask, string[]
117148

118149
GetMenuOptions(mask, flagNames, flagValues, out var buttonText, out var buttonTextMixed, out var optionNames, out var optionMaskValues, out _, enumType);
119150

151+
// This checks and update flags changes that are modified out of dropdown menu
152+
if (MaskCallbackInfo.m_Instance != null)
153+
MaskCallbackInfo.m_Instance.UpdateFlagChanges(mask, optionMaskValues);
154+
120155
Event evt = Event.current;
121156
if (evt.type == EventType.Repaint)
122157
{
@@ -126,7 +161,8 @@ internal static int DoMaskField(Rect position, int controlID, int mask, string[]
126161
else if ((evt.type == EventType.MouseDown && position.Contains(evt.mousePosition)) || evt.MainActionKeyForControl(controlID))
127162
{
128163
MaskCallbackInfo.m_Instance = new MaskCallbackInfo(controlID);
129-
PopupWindowWithoutFocus.Show(position, new MaskFieldDropDown(optionNames, flagValues, optionMaskValues, mask, MaskCallbackInfo.m_Instance.SetMaskValueDelegate));
164+
MaskCallbackInfo.m_Instance.m_DropDown = new MaskFieldDropDown(optionNames, flagValues, optionMaskValues, mask, MaskCallbackInfo.m_Instance.SetMaskValueDelegate);
165+
PopupWindowWithoutFocus.Show(position, MaskCallbackInfo.m_Instance.m_DropDown);
130166
}
131167

132168
return mask;

Editor/Mono/GUI/WindowLayout.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,12 +453,14 @@ private static void LoadLastUsedLayoutForCurrentMode(bool keepMainWindow)
453453
if (LoadWindowLayout(layout, layout != ProjectLayoutPath, false, keepMainWindow, false))
454454
return;
455455

456-
// step 6
457-
var defaultLayout = Path.Combine(layoutsDefaultModePreferencesPath, kDefaultLayoutName);
456+
// It is not mandatory that modes define a layout. In that case, skip right to the default layout.
457+
if (!string.IsNullOrEmpty(ModeService.GetDefaultModeLayout())
458+
&& LoadWindowLayout(ModeService.GetDefaultModeLayout(), true, false, keepMainWindow, false))
459+
return;
458460

459461
// If all else fails, load the default layout that ships with the editor. If that fails, prompt the user to
460462
// restore the default layouts.
461-
if (!LoadWindowLayout(defaultLayout, true, false, keepMainWindow, false))
463+
if (!LoadWindowLayout(GetDefaultLayoutPath(), true, false, keepMainWindow, false))
462464
{
463465
int option = 0;
464466

0 commit comments

Comments
 (0)