Skip to content

Commit 86305f7

Browse files
author
Unity Technologies
committed
Unity 2020.1.0a8 C# reference source code
1 parent 806e5e6 commit 86305f7

125 files changed

Lines changed: 1458 additions & 565 deletions

File tree

Some content is hidden

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

Editor/Mono/Annotation/AnnotationWindow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static public void IconChanged()
143143
float GetTopSectionHeight()
144144
{
145145
const int numberOfControls = 3;
146-
return EditorGUI.kSingleLineHeight * numberOfControls + EditorGUI.kControlVerticalSpacing * numberOfControls;
146+
return EditorGUI.kSingleLineHeight * numberOfControls + EditorGUI.kControlVerticalSpacing * (numberOfControls - 1) + EditorStyles.inspectorBig.padding.bottom;
147147
}
148148

149149
void OnEnable()
@@ -536,7 +536,7 @@ void DrawListHeader(string header, List<AInfo> elements, Rect rect, ref bool hea
536536

537537
// Column headers
538538
Rect columnRect = rect;
539-
columnRect.y -= gizmoTextSize.y - 3;
539+
columnRect.y -= gizmoTextSize.y + 3;
540540
columnRect.x = rect.width - gizmoTextRightAlign;
541541
GUI.Label(columnRect, gizmoText, m_Styles.columnHeaderStyle);
542542

Editor/Mono/AssetPipeline/TextureImporter.bindings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,5 +425,6 @@ public void SetTextureSettings(TextureImporterSettings src)
425425
internal extern bool removeMatte { get; set; }
426426

427427
public extern bool ignorePngGamma { get; set; }
428+
internal static readonly int MaxTextureSizeAllowedForReadable = 8192; //keep in sync with TextureImporter.h
428429
}
429430
}

Editor/Mono/BuildPipeline.bindings.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ public struct BuildPlayerOptions
188188
public BuildTargetGroup targetGroup {get; set; }
189189
public BuildTarget target {get; set; }
190190
public BuildOptions options {get; set; }
191+
public string[] extraScriptingDefines { get; set; }
191192
}
192193

193194
// Lets you programmatically build players or AssetBundles which can be loaded from the web.
@@ -262,10 +263,10 @@ public static BuildReport BuildPlayer(string[] levels, string locationPathName,
262263

263264
public static BuildReport BuildPlayer(BuildPlayerOptions buildPlayerOptions)
264265
{
265-
return BuildPlayer(buildPlayerOptions.scenes, buildPlayerOptions.locationPathName, buildPlayerOptions.assetBundleManifestPath, buildPlayerOptions.targetGroup, buildPlayerOptions.target, buildPlayerOptions.options);
266+
return BuildPlayer(buildPlayerOptions.scenes, buildPlayerOptions.locationPathName, buildPlayerOptions.assetBundleManifestPath, buildPlayerOptions.targetGroup, buildPlayerOptions.target, buildPlayerOptions.options, buildPlayerOptions.extraScriptingDefines);
266267
}
267268

268-
private static BuildReport BuildPlayer(string[] scenes, string locationPathName, string assetBundleManifestPath, BuildTargetGroup buildTargetGroup, BuildTarget target, BuildOptions options)
269+
private static BuildReport BuildPlayer(string[] scenes, string locationPathName, string assetBundleManifestPath, BuildTargetGroup buildTargetGroup, BuildTarget target, BuildOptions options, string[] extraScriptingDefines)
269270
{
270271
if (isBuildingPlayer)
271272
throw new InvalidOperationException("Cannot start a new build because there is already a build in progress.");
@@ -279,7 +280,7 @@ private static BuildReport BuildPlayer(string[] scenes, string locationPathName,
279280

280281
try
281282
{
282-
return BuildPlayerInternal(scenes, locationPathName, assetBundleManifestPath, buildTargetGroup, target, options);
283+
return BuildPlayerInternal(scenes, locationPathName, assetBundleManifestPath, buildTargetGroup, target, options, extraScriptingDefines);
283284
}
284285
catch (System.Exception exception)
285286
{
@@ -353,7 +354,7 @@ internal static string BuildStreamedSceneAssetBundle(string[] levels, string loc
353354
crc = 0;
354355
try
355356
{
356-
var report = BuildPlayerInternal(levels, locationPath, null, buildTargetGroup, target, options | BuildOptions.BuildAdditionalStreamedScenes | BuildOptions.ComputeCRC);
357+
var report = BuildPlayerInternal(levels, locationPath, null, buildTargetGroup, target, options | BuildOptions.BuildAdditionalStreamedScenes | BuildOptions.ComputeCRC, new string[] {});
357358
crc = report.summary.crc;
358359

359360
var summary = report.SummarizeErrors();
@@ -375,19 +376,19 @@ public static string BuildStreamedSceneAssetBundle(string[] levels, string locat
375376
return BuildStreamedSceneAssetBundle(levels, locationPath, target, out crc, 0);
376377
}
377378

378-
private static BuildReport BuildPlayerInternal(string[] levels, string locationPathName, string assetBundleManifestPath, BuildTargetGroup buildTargetGroup, BuildTarget target, BuildOptions options)
379+
private static BuildReport BuildPlayerInternal(string[] levels, string locationPathName, string assetBundleManifestPath, BuildTargetGroup buildTargetGroup, BuildTarget target, BuildOptions options, string[] extraScriptingDefines)
379380
{
380381
if (!BuildPlayerWindow.DefaultBuildMethods.IsBuildPathValid(locationPathName))
381382
throw new Exception("Invalid Build Path: " + locationPathName);
382383

383-
return BuildPlayerInternalNoCheck(levels, locationPathName, assetBundleManifestPath, buildTargetGroup, target, options, false);
384+
return BuildPlayerInternalNoCheck(levels, locationPathName, assetBundleManifestPath, buildTargetGroup, target, options, extraScriptingDefines, false);
384385
}
385386

386387
// Is a player currently building?
387388
public static extern bool isBuildingPlayer {[FreeFunction("IsBuildingPlayer")] get; }
388389

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

392393
#pragma warning disable 618
393394

Editor/Mono/BuildPlayerWindowBuildMethods.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public static void BuildPlayer(BuildPlayerOptions options)
171171
bool locationPathExistedBeforeBuild = System.IO.Directory.Exists(options.locationPathName);
172172
// Trigger build.
173173
// Note: report will be null, if delayToAfterScriptReload = true
174-
var report = BuildPipeline.BuildPlayerInternalNoCheck(options.scenes, options.locationPathName, null, options.targetGroup, options.target, options.options, delayToAfterScriptReload);
174+
var report = BuildPipeline.BuildPlayerInternalNoCheck(options.scenes, options.locationPathName, null, options.targetGroup, options.target, options.options, options.extraScriptingDefines, delayToAfterScriptReload);
175175

176176

177177
if (report != null)

Editor/Mono/Callbacks.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ internal sealed partial class RegisterPluginsAttribute : CallbackOrderAttribute
3636
public RegisterPluginsAttribute(int callbackOrder) { m_CallbackOrder = callbackOrder; }
3737

3838
[RequiredSignature]
39-
extern static IEnumerable<PluginDesc> Signature(BuildTarget target);
39+
static IEnumerable<PluginDesc> Signature(BuildTarget target) { throw new InvalidOperationException(); }
4040
}
4141

4242
[RequiredByNativeCode]
@@ -46,7 +46,7 @@ public sealed partial class PostProcessBuildAttribute : CallbackOrderAttribute
4646
public PostProcessBuildAttribute(int callbackOrder) { m_CallbackOrder = callbackOrder; }
4747

4848
[RequiredSignature]
49-
extern static void Signature(BuildTarget target, string pathToBuiltProject);
49+
static void Signature(BuildTarget target, string pathToBuiltProject) { throw new InvalidOperationException(); }
5050
}
5151

5252
[RequiredByNativeCode]
@@ -62,7 +62,7 @@ public sealed partial class PostProcessSceneAttribute : CallbackOrderAttribute
6262
public PostProcessSceneAttribute(int callbackOrder, int version) { m_CallbackOrder = callbackOrder; m_version = version; }
6363

6464
[RequiredSignature]
65-
extern static void Signature();
65+
static void Signature() { throw new InvalidOperationException(); }
6666
}
6767

6868
[RequiredByNativeCode]
@@ -73,7 +73,7 @@ public sealed partial class DidReloadScripts : CallbackOrderAttribute
7373
public DidReloadScripts(int callbackOrder) { m_CallbackOrder = callbackOrder; }
7474

7575
[RequiredSignature]
76-
extern static void Signature();
76+
static void Signature() { throw new InvalidOperationException(); }
7777
}
7878

7979
// Add this attribute to a static method to get a callback for opening an asset inside Unity before trying to open it with an external tool
@@ -84,10 +84,10 @@ public sealed partial class OnOpenAssetAttribute : CallbackOrderAttribute
8484
public OnOpenAssetAttribute(int callbackOrder) { m_CallbackOrder = callbackOrder; }
8585

8686
[RequiredSignature]
87-
extern static bool SignatureLine(int instanceID, int line);
87+
static bool SignatureLine(int instanceID, int line) { throw new InvalidOperationException(); }
8888

8989
[RequiredSignature]
90-
extern static bool SignatureLineColumn(int instanceID, int line, int column);
90+
static bool SignatureLineColumn(int instanceID, int line, int column) { throw new InvalidOperationException(); }
9191
}
9292
}
9393
}

Editor/Mono/CollectImportedDependenciesAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public CollectImportedDependenciesAttribute(Type importerType, uint version)
2828
public uint version { get { return m_Version; } }
2929

3030
[RequiredSignature]
31-
static extern string[] CollectImportedDependenciesSignature(string assetPath);
31+
static string[] CollectImportedDependenciesSignature(string assetPath) { throw new InvalidOperationException(); }
3232
}
3333

3434
static class ImportedDependenciesApi

Editor/Mono/EditorGUIUtility.cs

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ internal static Material GUITextureBlitSceneGUIMaterial
7373
internal static int s_LastControlID = 0;
7474
private static float s_LabelWidth = 0f;
7575

76-
private static Texture2D s_InfoIcon;
77-
private static Texture2D s_WarningIcon;
78-
private static Texture2D s_ErrorIcon;
76+
private static ScalableGUIContent s_InfoIcon;
77+
private static ScalableGUIContent s_WarningIcon;
78+
private static ScalableGUIContent s_ErrorIcon;
7979

8080
private static GUIStyle s_WhiteTextureStyle;
8181
private static GUIStyle s_BasicTextureStyle;
@@ -855,9 +855,34 @@ public static Vector2 GetIconSize()
855855
return Internal_GetIconSize();
856856
}
857857

858-
internal static Texture2D infoIcon => s_InfoIcon ?? (s_InfoIcon = LoadIcon("console.infoicon"));
859-
internal static Texture2D warningIcon => s_WarningIcon ?? (s_WarningIcon = LoadIcon("console.warnicon"));
860-
internal static Texture2D errorIcon => s_ErrorIcon ?? (s_ErrorIcon = LoadIcon("console.erroricon"));
858+
internal static Texture2D infoIcon
859+
{
860+
get
861+
{
862+
if (s_InfoIcon == null)
863+
s_InfoIcon = new ScalableGUIContent("console.infoicon");
864+
return s_InfoIcon.image as Texture2D;
865+
}
866+
}
867+
internal static Texture2D warningIcon
868+
{
869+
get
870+
{
871+
if (s_WarningIcon == null)
872+
s_WarningIcon = new ScalableGUIContent("console.warnicon");
873+
return s_WarningIcon.image as Texture2D;
874+
}
875+
}
876+
877+
internal static Texture2D errorIcon
878+
{
879+
get
880+
{
881+
if (s_ErrorIcon == null)
882+
s_ErrorIcon = new ScalableGUIContent("console.erroricon");
883+
return s_ErrorIcon.image as Texture2D;
884+
}
885+
}
861886

862887
internal static Texture2D GetHelpIcon(MessageType type)
863888
{

Editor/Mono/EditorHeaderItemAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ public EditorHeaderItemAttribute(Type targetType, int priority = 1)
2121
public Type TargetType;
2222

2323
[RequiredSignature]
24-
static extern bool SignatureBool(Rect rectangle, UnityEngine.Object[] targetObjets);
24+
static bool SignatureBool(Rect rectangle, UnityEngine.Object[] targetObjets) { throw new InvalidOperationException(); }
2525
}
2626
}

Editor/Mono/EditorResources.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
using System.Linq;
99
using JetBrains.Annotations;
1010
using UnityEditor.StyleSheets;
11+
using UnityEditor.Profiling;
1112
using UnityEngine;
1213
using UnityEngine.Internal;
13-
using UnityEngine.Scripting;
1414

1515
namespace UnityEditor.Experimental
1616
{
@@ -229,7 +229,7 @@ private static List<string> GetDefaultStyleCatalogPaths()
229229

230230
internal static void BuildCatalog()
231231
{
232-
using (new PerformanceTracker(nameof(BuildCatalog)))
232+
using (new EditorPerformanceTracker(nameof(BuildCatalog)))
233233
{
234234
s_StyleCatalog = new StyleCatalog();
235235
s_RefreshGlobalStyleCatalog = false;
@@ -245,7 +245,7 @@ internal static void BuildCatalog()
245245

246246
internal static void RefreshSkin()
247247
{
248-
using (new PerformanceTracker(nameof(RefreshSkin)))
248+
using (new EditorPerformanceTracker(nameof(RefreshSkin)))
249249
{
250250
if (!CanEnableExtendedStyles())
251251
return;

Editor/Mono/EditorWindow.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,12 @@ internal void SetPlayModeViewSize(Vector2 targetSize)
10231023
m_Parent.SetInternalGameViewDimensions(m_GameViewRect, m_GameViewClippedRect, m_GameViewTargetSize);
10241024
}
10251025

1026+
internal void SetMainPlayModeViewSize(Vector2 targetSize)
1027+
{
1028+
if (m_Parent != null)
1029+
m_Parent.SetMainPlayModeViewSize(targetSize);
1030+
}
1031+
10261032
internal void SetPlayModeView(bool value)
10271033
{
10281034
m_IsPlayModeView = value;

0 commit comments

Comments
 (0)