Skip to content

Commit 9778aae

Browse files
author
Unity Technologies
committed
Unity 6000.0.0f1 C# reference source code
1 parent e336592 commit 9778aae

File tree

321 files changed

+8878
-2431
lines changed

Some content is hidden

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

321 files changed

+8878
-2431
lines changed

Editor/IncrementalBuildPipeline/BeeBuildProgramCommon.Data/Data.cs

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public class ConfigurationData
3434
public string UnityVersion;
3535
public Version UnityVersionNumeric;
3636
public string UnitySourceCodePath;
37-
public bool AdvancedLicense;
3837
public bool Batchmode;
3938
public bool EmitDataForBeeWhy;
4039
public string NamedPipeOrUnixSocket;

Editor/Mono/Animation/AnimationWindow/CurveBindingUtility.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ public static object GetCurrentValue(AnimationWindowState state, EditorCurveBind
2929
// Otherwise, evaluate AnimationWindowCurve at current time.
3030
public static object GetCurrentValue(AnimationWindowState state, AnimationWindowCurve curve)
3131
{
32-
if (state.previewing && curve.rootGameObject != null)
32+
// UUM-66112 - state.linkedWithSequencer - Padding for issue in Timeline where muscle
33+
// values are not updated in the editor when previewing in the Animation Window.
34+
// Fallback to curve values.
35+
if (state.previewing && curve.rootGameObject != null && !state.linkedWithSequencer)
3336
{
3437
return GetCurrentValue(state, curve.binding);
3538
}

Editor/Mono/Annotation/SceneRenderModeWindow.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static class Styles
138138
new SceneView.CameraMode(DrawCameraMode.AlphaChannel, "Alpha Channel", kMiscellaneous),
139139
new SceneView.CameraMode(DrawCameraMode.Overdraw, "Overdraw", kMiscellaneous),
140140
new SceneView.CameraMode(DrawCameraMode.Mipmaps, "Mipmaps", kMiscellaneous),
141-
new SceneView.CameraMode(DrawCameraMode.TextureStreaming, "Texture Streaming", kMiscellaneous),
141+
new SceneView.CameraMode(DrawCameraMode.TextureStreaming, "Texture Mipmap Streaming", kMiscellaneous),
142142
new SceneView.CameraMode(DrawCameraMode.SpriteMask, "Sprite Mask", kMiscellaneous),
143143
new SceneView.CameraMode(DrawCameraMode.ValidateAlbedo, "Validate Albedo", kMiscellaneous),
144144
new SceneView.CameraMode(DrawCameraMode.ValidateMetalSpecular, "Validate Metal Specular", kMiscellaneous),
@@ -163,7 +163,7 @@ private float windowHeight
163163
modes = Styles.sBuiltinCameraModes.Count(mode => m_SceneView.IsCameraDrawModeSupported(mode) && mode.show) +
164164
SceneView.userDefinedModes.Count(mode => m_SceneView.IsCameraDrawModeSupported(mode) && mode.show);
165165

166-
return UpdatedHeight(headers, modes, GraphicsSettings.renderPipelineAsset != null);
166+
return UpdatedHeight(headers, modes, GraphicsSettings.isScriptableRenderPipelineEnabled);
167167
}
168168
}
169169

@@ -295,7 +295,7 @@ private void Draw(float listElementWidth)
295295
}
296296
}
297297

298-
if (GraphicsSettings.renderPipelineAsset != null)
298+
if (GraphicsSettings.isScriptableRenderPipelineEnabled)
299299
{
300300
DrawSeparator(ref drawPos);
301301
DrawRenderingDebuggerShortCut(drawPos);
@@ -339,7 +339,7 @@ private float RecalculateWindowHeight()
339339
}
340340
}
341341

342-
return UpdatedHeight(headers, modes, GraphicsSettings.renderPipelineAsset != null);
342+
return UpdatedHeight(headers, modes, GraphicsSettings.isScriptableRenderPipelineEnabled);
343343
}
344344

345345
private float UpdatedHeight(int headers, int modes, bool isSRP)

Editor/Mono/AssemblyInfo/AssemblyInfo.cs

+3
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@
153153
[assembly: InternalsVisibleTo("Unity.Muse.Common.Bridge")]
154154
[assembly: InternalsVisibleTo("Unity.Muse.Chat.Bridge")]
155155

156+
[assembly: InternalsVisibleTo("Unity.Multiplayer.Playmode.Editor.Bridge")]
157+
[assembly: InternalsVisibleTo("Unity.DedicatedServer.Editor.Bridge")]
158+
156159
[assembly: InternalsVisibleTo("Unity.Scenes")]
157160

158161
// This should move with the AnimationWindow to a module at some point

Editor/Mono/AssetPipeline/TextureGenerator.bindings.cs

+7-2
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,16 @@ public static unsafe class TextureGenerator
248248
{
249249
public static TextureGenerationOutput GenerateTexture(TextureGenerationSettings settings, NativeArray<Color32> colorBuffer)
250250
{
251-
return GenerateTextureImpl(settings, colorBuffer.GetUnsafeReadOnlyPtr(), colorBuffer.Length * UnsafeUtility.SizeOf<Color32>());
251+
return GenerateTextureImpl(settings, colorBuffer.GetUnsafeReadOnlyPtr(), colorBuffer.Length * UnsafeUtility.SizeOf<Color32>(), 4);
252+
}
253+
254+
public static TextureGenerationOutput GenerateTexture(TextureGenerationSettings settings, NativeArray<Color> colorBuffer)
255+
{
256+
return GenerateTextureImpl(settings, colorBuffer.GetUnsafeReadOnlyPtr(), colorBuffer.Length * UnsafeUtility.SizeOf<Color>(), 16);
252257
}
253258

254259
[NativeThrows]
255260
[NativeMethod("GenerateTextureScripting")]
256-
extern static unsafe TextureGenerationOutput GenerateTextureImpl(TextureGenerationSettings settings, void* colorBuffer, int colorBufferLength);
261+
extern static unsafe TextureGenerationOutput GenerateTextureImpl(TextureGenerationSettings settings, void* colorBuffer, int colorBufferLength, int bytesPerPixel);
257262
}
258263
}

Editor/Mono/Audio/AudioContainerWindow.cs

+15
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ void OnDisable()
139139
m_AddedElements.Clear();
140140
}
141141

142+
private void OnFocus()
143+
{
144+
if (State.AudioContainer != null)
145+
{
146+
UpdateTransportButtonStates();
147+
}
148+
}
149+
142150
void Update()
143151
{
144152
if (!m_IsVisible)
@@ -232,6 +240,7 @@ void CreateGUI()
232240

233241
m_Day0RootVisualElement.style.display = DisplayStyle.None;
234242
m_ContainerRootVisualElement.style.display = DisplayStyle.Flex;
243+
m_CachedElements = State.AudioContainer.elements.ToList();
235244
m_ClipsListView.Rebuild(); // Force a list rebuild when the list has changed or it will not always render correctly due to a UI toolkit bug.
236245
}
237246
}
@@ -519,12 +528,14 @@ void OnVolumeRandomizationEnabledChanged(SerializedProperty property)
519528
m_VolumeRandomizationButtonImage.style.backgroundImage = new StyleBackground(m_DiceIconOn);
520529
m_VolumeRandomizationRangeSlider.SetEnabled(true);
521530
m_VolumeRandomizationRangeField.SetEnabled(true);
531+
m_VolumeRandomRangeTracker.SetEnabled(true);
522532
}
523533
else
524534
{
525535
m_VolumeRandomizationButtonImage.style.backgroundImage = new StyleBackground(m_DiceIconOff);
526536
m_VolumeRandomizationRangeSlider.SetEnabled(false);
527537
m_VolumeRandomizationRangeField.SetEnabled(false);
538+
m_VolumeRandomRangeTracker.SetEnabled(false);
528539
}
529540
}
530541

@@ -624,12 +635,14 @@ void OnPitchRandomizationEnabledChanged(SerializedProperty property)
624635
m_PitchRandomizationButtonImage.style.backgroundImage = new StyleBackground(m_DiceIconOn);
625636
m_PitchRandomizationRangeSlider.SetEnabled(true);
626637
m_PitchRandomizationRangeField.SetEnabled(true);
638+
m_PitchRandomRangeTracker.SetEnabled(true);
627639
}
628640
else
629641
{
630642
m_PitchRandomizationButtonImage.style.backgroundImage = new StyleBackground(m_DiceIconOff);
631643
m_PitchRandomizationRangeSlider.SetEnabled(false);
632644
m_PitchRandomizationRangeField.SetEnabled(false);
645+
m_PitchRandomRangeTracker.SetEnabled(false);
633646
}
634647
}
635648

@@ -1190,12 +1203,14 @@ void OnTimeRandomizationEnabledChanged(SerializedProperty property)
11901203
m_TimeRandomizationButtonImage.style.backgroundImage = new StyleBackground(m_DiceIconOn);
11911204
m_TimeRandomizationRangeSlider.SetEnabled(true);
11921205
m_TimeRandomizationRangeField.SetEnabled(true);
1206+
m_TimeRandomRangeTracker.SetEnabled(true);
11931207
}
11941208
else
11951209
{
11961210
m_TimeRandomizationButtonImage.style.backgroundImage = new StyleBackground(m_DiceIconOff);
11971211
m_TimeRandomizationRangeSlider.SetEnabled(false);
11981212
m_TimeRandomizationRangeField.SetEnabled(false);
1213+
m_TimeRandomRangeTracker.SetEnabled(false);
11991214
}
12001215
}
12011216

Editor/Mono/Audio/UIElements/AudioRandomRangeSliderTracker.cs

+18-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
44

55
using System;
6+
using System.Transactions;
67
using UnityEngine;
78
using UnityEngine.UIElements;
89

@@ -16,11 +17,12 @@ class AudioRandomRangeSliderTracker : VisualElement
1617
public override object CreateInstance() => new AudioRandomRangeSliderTracker();
1718
}
1819

19-
static readonly CustomStyleProperty<Color> s_TrackerColorProperty = new("--tracker-color");
20+
static readonly CustomStyleProperty<Color> s_TrackerEnabledColorProperty = new("--tracker-color");
2021

2122
Slider m_ParentSlider;
2223
Vector2 m_Range = Vector2.zero;
23-
Color m_TrackerColor;
24+
Color m_TrackerEnabledColor;
25+
Color m_TrackerDisabledColor = Color.gray;
2426

2527
static void CustomStylesResolved(CustomStyleResolvedEvent evt)
2628
{
@@ -31,9 +33,9 @@ static void CustomStylesResolved(CustomStyleResolvedEvent evt)
3133

3234
void UpdateCustomStyles()
3335
{
34-
if (customStyle.TryGetValue(s_TrackerColorProperty, out var trackerColor))
36+
if (customStyle.TryGetValue(s_TrackerEnabledColorProperty, out var trackerColor))
3537
{
36-
m_TrackerColor = trackerColor;
38+
m_TrackerEnabledColor = trackerColor;
3739
}
3840
}
3941

@@ -54,6 +56,7 @@ internal static AudioRandomRangeSliderTracker Create(Slider parentSlider, Vector
5456
rangeTracker.generateVisualContent += GenerateVisualContent;
5557
rangeTracker.RegisterCallback<CustomStyleResolvedEvent>(CustomStylesResolved);
5658
rangeTracker.m_ParentSlider.RegisterCallback<GeometryChangedEvent>(OnGeometryChanged);
59+
rangeTracker.RegisterCallback<PropertyChangedEvent>(OnPropertyChanged);
5760

5861
return rangeTracker;
5962
}
@@ -72,6 +75,16 @@ static void OnGeometryChanged(GeometryChangedEvent evt)
7275
sliderTracker.SetRange(sliderTracker.m_Range);
7376
}
7477

78+
static void OnPropertyChanged(PropertyChangedEvent evt)
79+
{
80+
var sliderTracker = evt.elementTarget;
81+
82+
if (evt.property == "enabledSelf")
83+
{
84+
sliderTracker.MarkDirtyRepaint();
85+
}
86+
}
87+
7588
// Maps 'x' from the range '[x_min; x_max]' to the range '[y_min; y_max]'.
7689
static float Map(float x, float x_min, float x_max, float y_min, float y_max)
7790
{
@@ -102,7 +115,7 @@ static void GenerateVisualContent(MeshGenerationContext context)
102115
right = Mathf.Clamp(right, contentRect.xMin, contentRect.xMax);
103116

104117
// Draw the tracker.
105-
painter2D.fillColor = sliderTracker.m_TrackerColor;
118+
painter2D.fillColor = sliderTracker.enabledSelf ? sliderTracker.m_TrackerEnabledColor : sliderTracker.m_TrackerDisabledColor;
106119
painter2D.BeginPath();
107120
painter2D.MoveTo(new Vector2(left, contentRect.yMin));
108121
painter2D.LineTo(new Vector2(right, contentRect.yMin));

Editor/Mono/BaseBuildTarget.cs

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ internal abstract class BaseBuildTarget : IBuildTarget
1818

1919
public abstract RuntimePlatform RuntimePlatform { get; }
2020
public abstract string TargetName { get; }
21+
public abstract GUID Guid { get; }
22+
2123
public abstract int GetLegacyId { get; }
2224

2325
public virtual IBuildPlatformProperties BuildPlatformProperties => Properties as IBuildPlatformProperties;

Editor/Mono/BuildPipeline.bindings.cs

+31
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using UnityEditor.Scripting.ScriptCompilation;
1313
using System.Runtime.InteropServices;
1414
using UnityEditor.Build;
15+
using UnityEditor.Build.Profile;
1516
using UnityEngine.Scripting;
1617

1718
namespace UnityEditor
@@ -223,6 +224,14 @@ public struct BuildPlayerOptions
223224
public string[] extraScriptingDefines { get; set; }
224225
}
225226

227+
public struct BuildPlayerWithProfileOptions
228+
{
229+
public BuildProfile buildProfile { get; set; }
230+
public string locationPathName { get; set; }
231+
public string assetBundleManifestPath { get; set; }
232+
public BuildOptions options { get; set; }
233+
}
234+
226235
internal struct BuildPlayerDataOptions
227236
{
228237
public string[] scenes { get; set; }
@@ -276,6 +285,10 @@ public class BuildPipeline
276285
[FreeFunction(IsThreadSafe = true)]
277286
internal static extern string GetEditorTargetName();
278287

288+
[NativeHeader("Editor/Src/BuildPipeline/BuildPlayerHelpers.h")]
289+
[FreeFunction]
290+
internal static extern void ShowBuildProfileWindow();
291+
279292
[Obsolete("PushAssetDependencies has been made obsolete. Please use the new AssetBundle build system introduced in 5.0 and check BuildAssetBundles documentation for details.", true)]
280293
[FreeFunction]
281294
public static extern void PushAssetDependencies();
@@ -302,6 +315,24 @@ internal static BuildPlayerContext PreparePlayerBuild(BuildPlayerOptions buildPl
302315
return buildPlayerContext;
303316
}
304317

318+
/// <summary>
319+
/// Builds a player.
320+
/// </summary>
321+
/// <param name="buildPlayerWithProfileOptions">The BuildPlayerWithProfileOptions to be built with.</param>
322+
/// <returns>A BuildReport giving build process information.</returns>
323+
/// <exception cref="ArgumentException">Throws if build profile is null.</exception>
324+
public static BuildReport BuildPlayer(BuildPlayerWithProfileOptions buildPlayerWithProfileOptions)
325+
{
326+
var buildProfile = buildPlayerWithProfileOptions.buildProfile;
327+
if (buildProfile == null)
328+
throw new ArgumentException("Build profile is invalid.");
329+
330+
BuildProfileContext.instance.activeProfile = buildProfile;
331+
var buildPlayerOptions = BuildProfileModuleUtil.GetBuildPlayerOptionsFromActiveProfile(
332+
buildPlayerWithProfileOptions.locationPathName, buildPlayerWithProfileOptions.assetBundleManifestPath, buildPlayerWithProfileOptions.options);
333+
return BuildPlayer(buildPlayerOptions);
334+
}
335+
305336
public static BuildReport BuildPlayer(EditorBuildSettingsScene[] levels, string locationPathName, BuildTarget target, BuildOptions options)
306337
{
307338
BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();

Editor/Mono/BuildPipeline/BuildPlatform.cs

+18-25
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
44

55
using UnityEngine;
6+
using System;
67
using System.Collections.Generic;
78
using DiscoveredTargetInfo = UnityEditor.BuildTargetDiscovery.DiscoveredTargetInfo;
89
using TargetAttributes = UnityEditor.BuildTargetDiscovery.TargetAttributes;
910

1011
namespace UnityEditor.Build
1112
{
1213
// All settings for a build platform.
13-
internal class BuildPlatform
14+
internal class BuildPlatform : ICloneable
1415
{
1516
// short name used for texture settings, etc.
1617
public string name;
@@ -38,13 +39,24 @@ public BuildPlatform(string locTitle, string tooltip, string iconId, NamedBuildT
3839
{
3940
this.namedBuildTarget = namedBuildTarget;
4041
name = namedBuildTarget.TargetName;
41-
m_Title = new ScalableGUIContent(locTitle, null, iconId);
42+
43+
// Workaround for some platforms which have | in their name which is also used as separator for tooltips
44+
if (locTitle.Contains("|"))
45+
m_Title = new ScalableGUIContent(locTitle.Replace("|", " "), null, iconId);
46+
else
47+
m_Title = new ScalableGUIContent(locTitle, null, iconId);
48+
4249
m_SmallTitle = new ScalableGUIContent(null, null, iconId + ".Small");
4350
this.tooltip = tooltip;
4451
this.hideInUi = hideInUi;
4552
this.defaultTarget = defaultTarget;
4653
this.installed = installed;
4754
}
55+
56+
public object Clone()
57+
{
58+
return MemberwiseClone();
59+
}
4860
}
4961

5062
internal class BuildPlatformWithSubtarget : BuildPlatform
@@ -132,29 +144,10 @@ public string GetBuildTargetDisplayName(NamedBuildTarget namedBuildTarget, Build
132144
}
133145

134146
var suffix = namedBuildTarget == NamedBuildTarget.Server ? " Server" : "";
135-
136-
switch (target)
137-
{
138-
case BuildTarget.StandaloneWindows:
139-
case BuildTarget.StandaloneWindows64:
140-
return $"Windows{suffix}";
141-
case BuildTarget.StandaloneOSX:
142-
// Deprecated
143-
#pragma warning disable 612, 618
144-
case BuildTarget.StandaloneOSXIntel:
145-
case BuildTarget.StandaloneOSXIntel64:
146-
#pragma warning restore 612, 618
147-
return $"macOS{suffix}";
148-
// Deprecated
149-
#pragma warning disable 612, 618
150-
case BuildTarget.StandaloneLinux:
151-
case BuildTarget.StandaloneLinuxUniversal:
152-
#pragma warning restore 612, 618
153-
case BuildTarget.StandaloneLinux64:
154-
return $"Linux{suffix}";
155-
}
156-
157-
return "Unsupported Target";
147+
#pragma warning disable CS0618 // Member is obsolete
148+
string targetName = BuildTargetDiscovery.BuildPlatformDisplayName(target) + suffix;
149+
#pragma warning restore CS0618
150+
return targetName.Length == 0 ? "Unsupported Target" : targetName;
158151
}
159152

160153
public string GetModuleDisplayName(NamedBuildTarget namedBuildTarget, BuildTarget buildTarget)

0 commit comments

Comments
 (0)