Skip to content

Commit 4f72eda

Browse files
author
Unity Technologies
committed
Unity 6000.1.0a7 C# reference source code
1 parent 3b1c055 commit 4f72eda

File tree

137 files changed

+1732
-196
lines changed

Some content is hidden

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

137 files changed

+1732
-196
lines changed

Editor/Mono/BuildPipeline/BuildPlatform.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,22 @@ public object Clone()
7373
Texture2D GetCompoundSmallIcon()
7474
{
7575
GenerateCompoundData();
76-
return m_CompoundSmallIcon ?? smallIcon;
76+
return m_CompoundSmallIcon == null ? smallIcon : m_CompoundSmallIcon;
7777
}
7878

7979
Texture2D GetCompoundSmallIconForQualitySettings()
8080
{
8181
GenerateCompoundData();
82-
return m_CompoundSmallIconForQualitySettings ?? smallIcon;
82+
return m_CompoundSmallIconForQualitySettings == null ? smallIcon : m_CompoundSmallIconForQualitySettings;
8383
}
8484

8585
void GenerateCompoundData()
8686
{
87-
if (m_DerivedPlatforms != null)
87+
if (m_DerivedPlatforms != null && (m_CompoundSmallIcon == null || m_CompoundSmallIconForQualitySettings == null))
8888
{
8989
GenerateCompoundTooltip(m_DerivedPlatforms);
9090
GenerateCompoundTitle(m_DerivedPlatforms);
9191
GenerateCompoundIconTexture(m_DerivedPlatforms);
92-
m_DerivedPlatforms = null;
9392
}
9493
}
9594

Editor/Mono/BuildPlayerWindowBuildMethods.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public static void RegisterBuildPlayerHandler(Action<BuildPlayerOptions> func)
7474
/// <param name="defaultBuildOptions"></param>
7575
internal static void CallBuildMethods(bool askForBuildLocation, BuildOptions defaultBuildOptions)
7676
{
77-
if (EditorCompilationInterface.IsCompiling())
77+
EditorCompilationInterface.IsCompiling(out var isCompiling);
78+
if (isCompiling)
7879
{
7980
Debug.LogWarning("Cannot build player while editor is compiling scripts.");
8081
return;

Editor/Mono/BuildTargetDiscovery.bindings.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,14 @@ public PlatformInfo(){}
453453
new PlatformInfo
454454
{
455455
displayName = "Facebook Instant Games",
456+
description = L10n.Tr(
457+
"Build for Facebook Instant Games to take advantage of the extensive user base and social features within the Facebook and Messenger app. " +
458+
"This platform offers default settings for both mobile and desktop builds, along with optimization tools and a streamlined publishing process."
459+
),
456460
buildTarget = BuildTarget.WebGL,
457461
link = L10n.Tr("More details coming soon"),
458462
iconName = "BuildSettings.Facebook",
463+
requiredPackage = new string[]{"com.unity.meta-instant-games-sdk"},
459464
flags = PlatformAttributes.IsWindowsBuildTarget | PlatformAttributes.IsWindowsArm64BuildTarget | PlatformAttributes.IsLinuxBuildTarget | PlatformAttributes.IsMacBuildTarget | PlatformAttributes.IsVisibleInPlatformBrowserOnly | PlatformAttributes.IsDerivedBuildTarget
460465
}
461466
},
@@ -524,7 +529,7 @@ public PlatformInfo(){}
524529
description = L10n.Tr("Choose Embedded Linux, a compact version of Linux, if you are planning to build applications for embedded devices and appliances."),
525530
buildTarget = BuildTarget.EmbeddedLinux,
526531
iconName = "BuildSettings.EmbeddedLinux",
527-
flags = PlatformAttributes.IsHidden | PlatformAttributes.IsWindowsBuildTarget | PlatformAttributes.IsLinuxBuildTarget | PlatformAttributes.IsMacBuildTarget
532+
flags = PlatformAttributes.IsWindowsBuildTarget | PlatformAttributes.IsLinuxBuildTarget | PlatformAttributes.IsMacBuildTarget
528533
}
529534
},
530535
{
@@ -536,7 +541,7 @@ public PlatformInfo(){}
536541
description = L10n.Tr("Deploy the Unity runtime to automotive and other embedded systems utilizing the Blackberry® QNX® real-time operating system."),
537542
buildTarget = BuildTarget.QNX,
538543
iconName = "BuildSettings.QNX",
539-
flags = PlatformAttributes.IsHidden | PlatformAttributes.IsWindowsBuildTarget | PlatformAttributes.IsWindowsArm64BuildTarget | PlatformAttributes.IsLinuxBuildTarget | PlatformAttributes.IsMacBuildTarget
544+
flags = PlatformAttributes.IsWindowsBuildTarget | PlatformAttributes.IsWindowsArm64BuildTarget | PlatformAttributes.IsLinuxBuildTarget | PlatformAttributes.IsMacBuildTarget
540545
}
541546
},
542547
{

Editor/Mono/EditorApplication.bindings.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,14 @@ public static extern bool isPaused
119119
internal static extern bool IsInitialized();
120120

121121
// Is editor currently compiling scripts? (RO)
122-
public static bool isCompiling => EditorCompilationInterface.IsCompiling();
122+
public static bool isCompiling
123+
{
124+
get
125+
{
126+
EditorCompilationInterface.IsCompiling(out var isCompiling);
127+
return isCompiling;
128+
}
129+
}
123130

124131
// Is editor currently updating? (RO)
125132
public static extern bool isUpdating

Editor/Mono/GI/LightingDataAsset.bindings.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
using UnityEngine;
66
using UnityEngine.Bindings;
7+
using UnityEngine.Rendering;
8+
using UnityEngine.SceneManagement;
79

810
namespace UnityEditor
911
{
@@ -13,6 +15,21 @@ public sealed partial class LightingDataAsset : Object
1315
{
1416
private LightingDataAsset() {}
1517

18+
public LightingDataAsset(Scene scene)
19+
{
20+
Internal_Create(this, scene);
21+
}
22+
23+
[NativeThrows]
24+
private extern static void Internal_Create([Writable] LightingDataAsset self, Scene scene);
25+
26+
public extern void SetLights(Light[] lights);
27+
28+
public extern SphericalHarmonicsL2 GetAmbientProbe();
29+
public extern void SetAmbientProbe(SphericalHarmonicsL2 probe);
30+
public extern Texture GetDefaultReflectionCubemap();
31+
public extern void SetDefaultReflectionCubemap(Texture cubemap);
32+
1633
internal extern bool isValid {[NativeName("IsValid")] get; }
1734

1835
internal extern string validityErrorMessage { get; }

Editor/Mono/GI/Lightmapping.bindings.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,12 @@ internal static LightingSettings GetOrCreateLightingsSettings()
528528
[NativeName("GetLightingSettingsForScene")]
529529
public static extern LightingSettings GetLightingSettingsForScene(Scene scene);
530530

531+
[FreeFunction]
532+
public static extern LightingDataAsset GetLightingDataAssetForScene(Scene scene);
533+
534+
[FreeFunction(ThrowsException = true)]
535+
public static extern void SetLightingDataAssetForScene(Scene scene, LightingDataAsset lda);
536+
531537
public static void BakeMultipleScenes(string[] paths)
532538
{
533539
if (paths.Length == 0)

Editor/Mono/GameView/GameView.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ float maxScale
8686
[SerializeField] bool[] m_LowResolutionForAspectRatios = new bool[0];
8787
[SerializeField] int m_XRRenderMode = 0;
8888
[SerializeField] RenderTexture m_RenderTexture;
89+
[SerializeField] bool m_showToolbar = true;
8990

9091
int m_SizeChangeID = int.MinValue;
9192

@@ -210,7 +211,10 @@ internal void SetTargetDisplay(int id)
210211

211212
Rect GetViewInWindow(Rect pos)
212213
{
213-
return new Rect(0, EditorGUI.kWindowToolbarHeight, pos.width, pos.height - EditorGUI.kWindowToolbarHeight);
214+
if (showToolbar)
215+
return new Rect(0, EditorGUI.kWindowToolbarHeight, pos.width, pos.height - EditorGUI.kWindowToolbarHeight);
216+
217+
return new Rect(0, 0, pos.width, pos.height);
214218
}
215219

216220
Rect GetViewPixelRect(Rect viewRectInWindow)
@@ -309,6 +313,12 @@ Rect targetInParent // Area of the render target in parent view space
309313
Vector2 gameMouseOffset { get { return -viewInWindow.position - targetInView.position; } }
310314

311315
float gameMouseScale { get { return backingScale / m_ZoomArea.scale.y; } }
316+
317+
private bool showToolbar
318+
{
319+
get => m_showToolbar;
320+
set => m_showToolbar = value;
321+
}
312322

313323
internal bool drawGizmos
314324
{
@@ -332,6 +342,7 @@ public void OnEnable()
332342
prevSizeGroupType = (int)currentSizeGroupType;
333343
titleContent = GetLocalizedTitleContent();
334344
UpdateZoomAreaAndParent();
345+
showToolbar = ModeService.HasCapability(ModeCapability.GameViewToolbar, true);
335346

336347
ModeService.modeChanged += OnEditorModeChanged;
337348
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
@@ -910,6 +921,7 @@ void RepaintIfNeeded()
910921

911922
private void OnEditorModeChanged(ModeService.ModeChangedArgs args)
912923
{
924+
showToolbar = ModeService.HasCapability(ModeCapability.GameViewToolbar, true);
913925
Repaint();
914926
}
915927

@@ -948,7 +960,8 @@ private void OnGUI()
948960
UpdateZoomAreaAndParent();
949961
}
950962

951-
DoToolbarGUI();
963+
if (showToolbar)
964+
DoToolbarGUI();
952965

953966
if (type == EventType.MouseDown || type == EventType.MouseUp)
954967
{

Editor/Mono/Inspector/VisualElements/ClippingPlanes.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using UnityEditor.UIElements;
77
using UnityEngine.UIElements;
88
using System;
9+
using System.Diagnostics;
910

1011
namespace UnityEditor.Inspector
1112
{
@@ -14,6 +15,13 @@ internal class ClippingPlanes : BaseCompositeField<Vector2, FloatField, float>
1415
[Serializable]
1516
public new class UxmlSerializedData : BaseCompositeField<Vector2, FloatField, float>.UxmlSerializedData
1617
{
18+
[RegisterUxmlCache]
19+
[Conditional("UNITY_EDITOR")]
20+
public new static void Register()
21+
{
22+
BaseCompositeField<Vector2, FloatField, float>.UxmlSerializedData.Register();
23+
}
24+
1725
public override object CreateInstance() => new ClippingPlanes();
1826
}
1927

@@ -76,6 +84,7 @@ public ClippingPlanes() : base(labelProperty, 2)
7684
field.RemoveFromClassList(k_CompositeFieldStyle);
7785
field.RemoveFromClassList(BaseField<bool>.alignedFieldUssClassName);
7886
field.style.marginLeft = field.style.marginRight = 0;
87+
field.isDelayed = true;
7988

8089
var label = field.Q<Label>();
8190
label.style.flexBasis = label.style.minWidth = new StyleLength(k_NearFarLabelsWidth);

Editor/Mono/Inspector/VisualElements/ObjectFieldWithPrompt.cs

Lines changed: 15 additions & 0 deletions
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.Diagnostics;
67
using System.Text;
78
using Unity.Properties;
89
using UnityEngine;
@@ -21,6 +22,20 @@ internal class ObjectFieldWithPrompt : BaseField<Object>
2122
[UnityEngine.Internal.ExcludeFromDocs, Serializable]
2223
public new class UxmlSerializedData : BaseField<Object>.UxmlSerializedData
2324
{
25+
[RegisterUxmlCache]
26+
[Conditional("UNITY_EDITOR")]
27+
public new static void Register()
28+
{
29+
BaseField<Object>.UxmlSerializedData.Register();
30+
UxmlDescriptionCache.RegisterType(typeof(UxmlSerializedData), new UxmlAttributeNames[]
31+
{
32+
new (nameof(allowSceneObjects), "allow-scene-objects"),
33+
new (nameof(objectType), "type", typeof(Object)),
34+
new (nameof(title), "title"),
35+
new (nameof(message), "message"),
36+
});
37+
}
38+
2439
#pragma warning disable 649
2540
[SerializeField] bool allowSceneObjects;
2641
[SerializeField, UxmlIgnore, HideInInspector] UxmlAttributeFlags allowSceneObjects_UxmlAttributeFlags;

Editor/Mono/Inspector/VisualElements/ProjectSettings/BuiltInShaderElement.cs

Lines changed: 14 additions & 0 deletions
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.Diagnostics;
67
using UnityEngine;
78
using UnityEngine.UIElements;
89

@@ -20,6 +21,19 @@ internal enum BuiltinShaderMode
2021
[UnityEngine.Internal.ExcludeFromDocs, Serializable]
2122
public new class UxmlSerializedData : VisualElement.UxmlSerializedData
2223
{
24+
[RegisterUxmlCache]
25+
[Conditional("UNITY_EDITOR")]
26+
public new static void Register()
27+
{
28+
UxmlDescriptionCache.RegisterType(typeof(UxmlSerializedData), new UxmlAttributeNames[]
29+
{
30+
new (nameof(shaderMode), "shader-mode"),
31+
new (nameof(customShader), "custom-shader"),
32+
new (nameof(shaderModeLabel), "shader-mode-label"),
33+
new (nameof(customShaderLabel), "custom-shader-label"),
34+
});
35+
}
36+
2337
#pragma warning disable 649
2438
[SerializeField, UxmlAttribute("shader-mode")] string shaderMode;
2539
[SerializeField, UxmlIgnore, HideInInspector] UxmlAttributeFlags shaderMode_UxmlAttributeFlags;

0 commit comments

Comments
 (0)