Skip to content

Commit 4fc5eb0

Browse files
author
Unity Technologies
committed
Unity 2020.1.0a11 C# reference source code
1 parent f78f409 commit 4fc5eb0

File tree

186 files changed

+3727
-2815
lines changed

Some content is hidden

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

186 files changed

+3727
-2815
lines changed

Editor/Mono/AssetPipeline/TextureImporterEnums.cs

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -150,45 +150,41 @@ public enum TextureImporterFormat
150150
ASTC_10x10 = 52,
151151
ASTC_12x12 = 53,
152152

153-
// please note that obsolete attrs are currently disabled because we have tests that checks for "no warnings"
154-
// yet at the same time there are packages that reference old ASTC enums.
155-
// hence the only way is to go to trunk -> fix packages -> obsolete
156-
157-
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
158-
// [System.Obsolete("Use ASTC_4x4 (UnityUpgradable) -> ASTC_4x4")]
153+
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
154+
[System.Obsolete("Use ASTC_4x4 (UnityUpgradable) -> ASTC_4x4")]
159155
ASTC_RGB_4x4 = 48,
160-
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
161-
// [System.Obsolete("Use ASTC_5x5 (UnityUpgradable) -> ASTC_5x5")]
156+
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
157+
[System.Obsolete("Use ASTC_5x5 (UnityUpgradable) -> ASTC_5x5")]
162158
ASTC_RGB_5x5 = 49,
163-
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
164-
// [System.Obsolete("Use ASTC_6x6 (UnityUpgradable) -> ASTC_6x6")]
159+
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
160+
[System.Obsolete("Use ASTC_6x6 (UnityUpgradable) -> ASTC_6x6")]
165161
ASTC_RGB_6x6 = 50,
166-
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
167-
// [System.Obsolete("Use ASTC_8x8 (UnityUpgradable) -> ASTC_8x8")]
162+
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
163+
[System.Obsolete("Use ASTC_8x8 (UnityUpgradable) -> ASTC_8x8")]
168164
ASTC_RGB_8x8 = 51,
169-
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
170-
// [System.Obsolete("Use ASTC_10x10 (UnityUpgradable) -> ASTC_10x10")]
165+
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
166+
[System.Obsolete("Use ASTC_10x10 (UnityUpgradable) -> ASTC_10x10")]
171167
ASTC_RGB_10x10 = 52,
172-
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
173-
// [System.Obsolete("Use ASTC_12x12 (UnityUpgradable) -> ASTC_12x12")]
168+
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
169+
[System.Obsolete("Use ASTC_12x12 (UnityUpgradable) -> ASTC_12x12")]
174170
ASTC_RGB_12x12 = 53,
175-
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
176-
// [System.Obsolete("Use ASTC_4x4 (UnityUpgradable) -> ASTC_4x4")]
171+
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
172+
[System.Obsolete("Use ASTC_4x4 (UnityUpgradable) -> ASTC_4x4")]
177173
ASTC_RGBA_4x4 = 54,
178-
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
179-
// [System.Obsolete("Use ASTC_5x5 (UnityUpgradable) -> ASTC_5x5")]
174+
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
175+
[System.Obsolete("Use ASTC_5x5 (UnityUpgradable) -> ASTC_5x5")]
180176
ASTC_RGBA_5x5 = 55,
181-
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
182-
// [System.Obsolete("Use ASTC_6x6 (UnityUpgradable) -> ASTC_6x6")]
177+
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
178+
[System.Obsolete("Use ASTC_6x6 (UnityUpgradable) -> ASTC_6x6")]
183179
ASTC_RGBA_6x6 = 56,
184-
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
185-
// [System.Obsolete("Use ASTC_8x8 (UnityUpgradable) -> ASTC_8x8")]
180+
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
181+
[System.Obsolete("Use ASTC_8x8 (UnityUpgradable) -> ASTC_8x8")]
186182
ASTC_RGBA_8x8 = 57,
187-
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
188-
// [System.Obsolete("Use ASTC_10x10 (UnityUpgradable) -> ASTC_10x10")]
183+
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
184+
[System.Obsolete("Use ASTC_10x10 (UnityUpgradable) -> ASTC_10x10")]
189185
ASTC_RGBA_10x10 = 58,
190-
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
191-
// [System.Obsolete("Use ASTC_12x12 (UnityUpgradable) -> ASTC_12x12")]
186+
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
187+
[System.Obsolete("Use ASTC_12x12 (UnityUpgradable) -> ASTC_12x12")]
192188
ASTC_RGBA_12x12 = 59,
193189

194190
// Nintendo 3DS-flavoured ETC

Editor/Mono/AssetPipeline/TextureImporterTypes.bindings.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public struct SpriteMetaData
2424
[System.Serializable]
2525
[StructLayout(LayoutKind.Sequential)]
2626
[NativeAsStruct]
27+
[NativeType(CodegenOptions.Custom, "TextureImporterSettings")]
2728
[NativeHeader("Editor/Src/AssetPipeline/TextureImporting/TextureImporter.bindings.h")]
2829
[NativeHeader("Editor/Src/AssetPipeline/TextureImporting/TextureImporterTypes.h")]
2930
public sealed partial class TextureImporterSettings
@@ -95,9 +96,6 @@ public sealed partial class TextureImporterSettings
9596
[SerializeField]
9697
int m_AlphaIsTransparency;
9798

98-
[SerializeField]
99-
bool m_IgnorePngGamma;
100-
10199
[SerializeField]
102100
float m_SpriteTessellationDetail;
103101

@@ -109,6 +107,9 @@ public sealed partial class TextureImporterSettings
109107
[SerializeField]
110108
int m_SingleChannelComponent;
111109

110+
[SerializeField]
111+
int m_IgnorePngGamma;
112+
112113
// memory layout of these is in TextureSettings.h
113114
[SerializeField]
114115
[NativeName("m_TextureSettings.m_FilterMode")]
@@ -339,8 +340,8 @@ public bool alphaIsTransparency
339340

340341
public bool ignorePngGamma
341342
{
342-
get { return m_IgnorePngGamma; }
343-
set { m_IgnorePngGamma = value; }
343+
get { return m_IgnorePngGamma != 0; }
344+
set { m_IgnorePngGamma = value ? 1 : 0; }
344345
}
345346

346347
public int spriteMode

Editor/Mono/BuildPipeline.bindings.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using UnityEditor.Build.Reporting;
1111
using Mono.Cecil;
1212
using UnityEditor.Scripting.ScriptCompilation;
13+
using System.Runtime.InteropServices;
1314

1415
namespace UnityEditor
1516
{
@@ -191,6 +192,15 @@ public struct BuildPlayerOptions
191192
public string[] extraScriptingDefines { get; set; }
192193
}
193194

195+
internal struct BuildPlayerDataOptions
196+
{
197+
public string[] scenes { get; set; }
198+
public BuildTargetGroup targetGroup { get; set; }
199+
public BuildTarget target { get; set; }
200+
public BuildOptions options { get; set; }
201+
public string[] extraScriptingDefines { get; set; }
202+
}
203+
194204
// Lets you programmatically build players or AssetBundles which can be loaded from the web.
195205
[NativeHeader("Editor/Mono/BuildPipeline.bindings.h")]
196206
[StaticAccessor("BuildPipeline", StaticAccessorType.DoubleColon)]
@@ -385,11 +395,26 @@ private static BuildReport BuildPlayerInternal(string[] levels, string locationP
385395
}
386396

387397
// Is a player currently building?
388-
public static extern bool isBuildingPlayer {[FreeFunction("IsBuildingPlayer")] get; }
398+
public static extern bool isBuildingPlayer { [FreeFunction("IsBuildingPlayer")] get; }
389399

390400
// Just like BuildPlayer, but does not check for Pro license. Used from build player dialog.
391401
internal static extern BuildReport BuildPlayerInternalNoCheck(string[] levels, string locationPathName, string assetBundleManifestPath, BuildTargetGroup buildTargetGroup, BuildTarget target, BuildOptions options, string[] extraScriptingDefines, bool delayToAfterScriptReload);
392402

403+
[StructLayout(LayoutKind.Sequential)]
404+
private struct BuildPlayerDataResult
405+
{
406+
internal BuildReport report;
407+
internal RuntimeClassRegistry usedClasses;
408+
}
409+
410+
internal static BuildReport BuildPlayerData(BuildPlayerDataOptions buildPlayerDataOptions, out RuntimeClassRegistry usedClasses)
411+
{
412+
var result = BuildPlayerData(buildPlayerDataOptions);
413+
usedClasses = result.usedClasses;
414+
return result.report;
415+
}
416+
417+
private static extern BuildPlayerDataResult BuildPlayerData(BuildPlayerDataOptions buildPlayerDataOptions);
393418
#pragma warning disable 618
394419

395420
// Builds an AssetBundle.

Editor/Mono/BuildPipeline/AssemblyStripper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private static string UnityLinkerPath
4646
{
4747
get
4848
{
49-
return Path.Combine(IL2CPPUtils.GetIl2CppFolder(), "build/UnityLinker.exe");
49+
return Path.Combine(IL2CPPUtils.GetIl2CppFolder(), "build/deploy/net471/UnityLinker.exe");
5050
}
5151
}
5252

Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ private void CopyNativePlugins(BuildPostProcessArgs args, out List<string> cppPl
176176

177177
if (isDirectory)
178178
{
179-
FileUtil.CopyDirectoryRecursive(imp.assetPath, finalDestinationPath);
179+
// Since we may be copying from Assets make sure to not include .meta files to the build
180+
FileUtil.CopyDirectoryRecursive(imp.assetPath, finalDestinationPath, overwrite: false, ignoreMeta: true);
180181
}
181182
else
182183
{

Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,12 +521,12 @@ private void RunIl2CppWithArguments(List<string> arguments, Action<ProcessStartI
521521

522522
private string GetIl2CppExe()
523523
{
524-
return IL2CPPUtils.GetIl2CppFolder() + "/build/il2cpp.exe";
524+
return IL2CPPUtils.GetIl2CppFolder() + "/build/deploy/net471/il2cpp.exe";
525525
}
526526

527527
private string GetIl2CppCoreExe()
528528
{
529-
return IL2CPPUtils.GetIl2CppFolder() + "/build/il2cppcore/il2cppcore.dll";
529+
return IL2CPPUtils.GetIl2CppFolder() + "/build/deploy/il2cppcore/il2cppcore.dll";
530530
}
531531

532532
private bool ShouldUseIl2CppCore()

Editor/Mono/BuildTargetDiscovery.bindings.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ public enum VRAttributes
6666
SupportStereoInstancingRendering = (1 << 1),
6767
SupportStereoMultiviewRendering = (1 << 2),
6868
SupportStereo360Capture = (1 << 3),
69-
SupportVuforia = (1 << 4),
70-
SupportTango = (1 << 5)
69+
SupportTango = (1 << 4)
7170
}
7271

7372
[StructLayout(LayoutKind.Sequential)]

Editor/Mono/Camera/ScriptableBakedReflectionSystemSettings.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
44

55
using System;
6+
using JetBrains.Annotations;
67
using UnityEngine;
7-
using UnityEngine.Assertions;
88
using UnityEngine.Scripting;
99

1010
namespace UnityEditor.Experimental.Rendering
@@ -19,23 +19,26 @@ public static IScriptableBakedReflectionSystem system
1919
}
2020
static IScriptableBakedReflectionSystem Internal_ScriptableBakedReflectionSystemSettings_system
2121
{
22-
[RequiredByNativeCode]
23-
get { return s_Instance != null ? s_Instance.implementation : null; }
24-
[RequiredByNativeCode]
25-
set
22+
[RequiredByNativeCode] get { return s_Instance?.implementation; }
23+
[RequiredByNativeCode] set
2624
{
27-
Assert.IsNotNull(s_Instance, "Instance must be initialized from CPP before IntializeOnLoad");
25+
if (s_Instance == null)
26+
{
27+
Console.WriteLine("[WARNING] ScriptableBakedReflectionSystemWrapper instance must be initialized from CPP before InitializeOnLoad");
28+
return;
29+
}
2830

2931
if (value == null || value.Equals(null))
3032
{
3133
Debug.LogError("'null' cannot be assigned to ScriptableBakedReflectionSystemSettings.system");
3234
return;
3335
}
36+
3437
// We always allow the BuiltinBakedReflectionSystem, it is set by Unity on domain reload
3538
// However, we issue a warning when multiple different IScriptableBakedReflectionSystem have been assigned.
36-
else if (!(system is BuiltinBakedReflectionSystem)
37-
&& !(value is BuiltinBakedReflectionSystem)
38-
&& system != value)
39+
if (!(system is BuiltinBakedReflectionSystem)
40+
&& !(value is BuiltinBakedReflectionSystem)
41+
&& system != value)
3942
Debug.LogWarningFormat("ScriptableBakedReflectionSystemSettings.system is assigned more than once. Only a the last instance will be used. (Last instance {0}, New instance {1})", system, value);
4043

4144
if (s_Instance.implementation != value)
@@ -49,7 +52,7 @@ static IScriptableBakedReflectionSystem Internal_ScriptableBakedReflectionSystem
4952

5053
static ScriptableBakedReflectionSystemWrapper s_Instance = null;
5154

52-
[RequiredByNativeCode]
55+
[UsedImplicitly, RequiredByNativeCode]
5356
static ScriptableBakedReflectionSystemWrapper Internal_ScriptableBakedReflectionSystemSettings_InitializeWrapper(IntPtr ptr)
5457
{
5558
s_Instance = new ScriptableBakedReflectionSystemWrapper(ptr);

Editor/Mono/EditorGUI.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3352,7 +3352,8 @@ internal static string TagFieldInternal(Rect position, GUIContent label, string
33523352
}
33533353
else if (Event.current.type == EventType.Repaint)
33543354
{
3355-
style.Draw(position, EditorGUIUtility.TempContent(tag), id, false, position.Contains(evt.mousePosition));
3355+
style.Draw(position, showMixedValue ? s_MixedValueContent : EditorGUIUtility.TempContent(tag),
3356+
id, false, position.Contains(evt.mousePosition));
33563357
}
33573358

33583359
return tag;
@@ -3422,7 +3423,8 @@ internal static int LayerFieldInternal(Rect position, GUIContent label, int laye
34223423
}
34233424
else if (evt.type == EventType.Repaint)
34243425
{
3425-
style.Draw(position, EditorGUIUtility.TempContent(InternalEditorUtility.GetLayerName(layer)), id, false, position.Contains(evt.mousePosition));
3426+
var layerFieldContent = showMixedValue ? s_MixedValueContent : EditorGUIUtility.TempContent(InternalEditorUtility.GetLayerName(layer));
3427+
style.Draw(position, layerFieldContent, id, false, position.Contains(evt.mousePosition));
34263428
}
34273429

34283430
return layer;
@@ -6108,10 +6110,7 @@ internal static Texture2D transparentCheckerTexture
61086110
private static Material GetPreviewMaterial(ref Material m, string shaderPath)
61096111
{
61106112
if (m == null)
6111-
{
61126113
m = new Material(EditorGUIUtility.LoadRequired(shaderPath) as Shader);
6113-
m.hideFlags = HideFlags.HideAndDontSave;
6114-
}
61156114
return m;
61166115
}
61176116

Editor/Mono/EditorGUIUtility.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ internal static Material GUITextureBlit2SRGBMaterial
4949
{
5050
Shader shader = LoadRequired("SceneView/GUITextureBlit2SRGB.shader") as Shader;
5151
s_GUITextureBlit2SRGBMaterial = new Material(shader);
52+
s_GUITextureBlit2SRGBMaterial.hideFlags |= HideFlags.DontSaveInEditor;
5253
}
5354
s_GUITextureBlit2SRGBMaterial.SetFloat("_ManualTex2SRGB", QualitySettings.activeColorSpace == ColorSpace.Linear ? 1.0f : 0.0f);
5455
return s_GUITextureBlit2SRGBMaterial;
@@ -64,6 +65,7 @@ internal static Material GUITextureBlitSceneGUIMaterial
6465
{
6566
Shader shader = LoadRequired("SceneView/GUITextureBlitSceneGUI.shader") as Shader;
6667
s_GUITextureBlitSceneGUI = new Material(shader);
68+
s_GUITextureBlitSceneGUI.hideFlags |= HideFlags.DontSaveInEditor;
6769
}
6870
return s_GUITextureBlitSceneGUI;
6971
}
@@ -963,7 +965,10 @@ private static UnityObject Load(string filename, Type type)
963965

964966
asset = bundle.LoadAsset(filename, type);
965967
if (asset != null)
968+
{
969+
asset.hideFlags |= HideFlags.HideAndDontSave;
966970
return asset;
971+
}
967972

968973
return AssetDatabase.LoadAssetAtPath(filename, type);
969974
}

Editor/Mono/EditorMode/ModeService.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,13 @@ private static string GetProjectPrefKeyName(string prefix)
427427
return key;
428428
}
429429

430+
internal static void RefreshMenus()
431+
{
432+
Menu.ResetMenus(true);
433+
UpdateModeMenus(currentIndex);
434+
EditorUtility.Internal_UpdateAllMenus();
435+
}
436+
430437
private static void UpdateModeMenus(int modeIndex)
431438
{
432439
var items = GetModeDataSection(modeIndex, ModeDescriptor.MenusKey);

Editor/Mono/EditorUserBuildSettings.bindings.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,11 +630,25 @@ public static extern bool switchNVNShaderDebugging
630630
}
631631

632632
// Enable debug validation of NVN drawcalls
633-
public static extern bool switchNVNDrawValidation
633+
public static bool switchNVNDrawValidation
634634
{
635-
[NativeMethod("GetNVNDrawValidation")]
635+
get { return switchNVNDrawValidation_Heavy; }
636+
set { switchNVNDrawValidation_Heavy = value; }
637+
}
638+
639+
public static extern bool switchNVNDrawValidation_Light
640+
{
641+
[NativeMethod("GetNVNDrawValidationLight")]
642+
get;
643+
[NativeMethod("SetNVNDrawValidationLight")]
644+
set;
645+
}
646+
647+
public static extern bool switchNVNDrawValidation_Heavy
648+
{
649+
[NativeMethod("GetNVNDrawValidationHeavy")]
636650
get;
637-
[NativeMethod("SetNVNDrawValidation")]
651+
[NativeMethod("SetNVNDrawValidationHeavy")]
638652
set;
639653
}
640654

Editor/Mono/EditorWindow.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ internal void ClearPersistentViewData()
136136
Vector2 m_GameViewTargetSize;
137137

138138
bool m_IsPlayModeView;
139-
bool m_DontClearBackground;
140139
EventInterests m_EventInterests = new EventInterests();
141140
bool m_DisableInputEvents;
142141

@@ -311,21 +310,6 @@ internal void DrawNotification()
311310
EditorGUI.DoDropShadowLabel(r, m_Notification, scaledNotificationText, .3f);
312311
}
313312

314-
internal bool dontClearBackground
315-
{
316-
get
317-
{
318-
return m_DontClearBackground;
319-
}
320-
set
321-
{
322-
m_DontClearBackground = value;
323-
if (m_Parent && m_Parent.actualView == this)
324-
m_Parent.backgroundValid = false;
325-
}
326-
}
327-
328-
329313
// Does the window automatically repaint whenever the scene has changed?
330314
public bool autoRepaintOnSceneChange
331315
{

0 commit comments

Comments
 (0)