Skip to content

Commit fe6a328

Browse files
author
Unity Technologies
committed
Unity 2018.2.11f1 C# reference source code
1 parent 84f4a2f commit fe6a328

File tree

8 files changed

+57
-16
lines changed

8 files changed

+57
-16
lines changed

Editor/Mono/Inspector/Editor.cs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,6 @@ static class Styles
387387
static Styles()
388388
{
389389
centerStyle.alignment = TextAnchor.MiddleCenter;
390-
// modify header bottom padding on a mutable copy here
391-
// this was done rather than modifying the style asset itself in order to minimize possible side effects where the style was already used
392-
inspectorBig.padding.bottom -= 1;
393390
}
394391
}
395392

@@ -663,14 +660,24 @@ public void DrawHeader()
663660
// If we call DrawHeader from inside an an editor's OnInspectorGUI call, we have to do special handling.
664661
// (See DrawHeaderFromInsideHierarchy for details.)
665662
// We know we're inside the OnInspectorGUI block (or a similar vertical block) if hierarchyMode is set to true.
666-
if (EditorGUIUtility.hierarchyMode)
663+
var hierarchyMode = EditorGUIUtility.hierarchyMode;
664+
if (hierarchyMode)
667665
DrawHeaderFromInsideHierarchy();
668666
else
669667
OnHeaderGUI();
670668

671669
if (finishedDefaultHeaderGUI != null)
672670
{
673-
EditorGUIUtility.ResetGUIState();
671+
// see DrawHeaderFromInsideHierarchy()
672+
if (hierarchyMode)
673+
{
674+
EditorGUILayout.EndVertical();
675+
EditorGUILayout.BeginVertical(GUILayoutUtility.topLevel.style);
676+
}
677+
// reset label and field widths to defaults
678+
EditorGUIUtility.labelWidth = 0f;
679+
EditorGUIUtility.fieldWidth = 0f;
680+
674681
GUILayout.Space(
675682
-1f // move up to cover up bottom pixel of header box
676683
- Styles.inspectorBig.margin.bottom
@@ -679,13 +686,19 @@ public void DrawHeader()
679686
);
680687

681688
// align with controls in the Inspector
682-
// see InspectorWindow.DrawEditor before calls to OnOptimizedInspectorGUI()/OnInspectorGUI()
689+
// see InspectorWindow.DrawEditor() before calls to OnOptimizedInspectorGUI()/OnInspectorGUI()
683690
EditorGUIUtility.hierarchyMode = true;
684691
EditorGUIUtility.wideMode = EditorGUIUtility.contextWidth > k_WideModeMinWidth;
685692

686693
EditorGUILayout.BeginVertical(Styles.postLargeHeaderBackground, GUILayout.ExpandWidth(true));
687694
finishedDefaultHeaderGUI(this);
688695
EditorGUILayout.EndVertical();
696+
if (hierarchyMode)
697+
{
698+
EditorGUILayout.EndVertical();
699+
// see InspectorWindow.DoOnInspectorGUI()
700+
EditorGUILayout.BeginVertical(UseDefaultMargins() ? EditorStyles.inspectorDefaultMargins : GUIStyle.none);
701+
}
689702
}
690703
}
691704

@@ -796,10 +809,9 @@ internal virtual void DrawHeaderHelpAndSettingsGUI(Rect r)
796809
// draw the header, and then start a new vertical block with the same style.
797810
private void DrawHeaderFromInsideHierarchy()
798811
{
799-
GUIStyle style = GUILayoutUtility.topLevel.style;
800812
EditorGUILayout.EndVertical();
801813
OnHeaderGUI();
802-
EditorGUILayout.BeginVertical(style);
814+
EditorGUILayout.BeginVertical(GUILayoutUtility.topLevel.style);
803815
}
804816

805817
internal static Rect DrawHeaderGUI(Editor editor, string header)

Editor/Mono/Inspector/GameObjectInspector.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ public Styles()
6868

6969
// Seems to be a bug in the way controls with margin internal to layout groups with padding calculate position. We'll work around it here.
7070
layerPopup.margin.right = 0;
71-
72-
// match modification in Editor.Styles
73-
inspectorBig.padding.bottom -= 1;
7471
}
7572
}
7673
static Styles s_Styles;

Editor/Mono/Inspector/InspectorWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@ private void DrawEditor(Editor[] editors, int editorIndex, bool rebuildOptimized
12641264
Rect contentRect = new Rect();
12651265
bool excludedClass = ModuleMetadata.GetModuleIncludeSettingForObject(target) == ModuleIncludeSetting.ForceExclude;
12661266
if (excludedClass)
1267-
EditorGUILayout.HelpBox("The module which implements this component type has been force excluded in player settings. This object will be removed in play mode and from any builds you make.", MessageType.Warning);
1267+
EditorGUILayout.HelpBox("The built-in package '" + ModuleMetadata.GetExcludingModuleForObject(target) + "', which is required this component type has been disabled in Package Manager. This object will be removed in play mode and from any builds you make.", MessageType.Warning);
12681268

12691269
using (new EditorGUI.DisabledScope(!editor.IsEnabled() || excludedClass))
12701270
{

Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ public override void PostprocessMessage(ref CompilerMessage message)
142142
var index = message.message.IndexOf("Consider adding a reference to assembly");
143143
if (index != -1)
144144
message.message = message.message.Substring(0, index);
145-
var moduleName = GetNiceDisplayNameForModule(match.Groups[1].Value);
145+
var moduleName = match.Groups[1].Value;
146+
moduleName = ModuleMetadata.GetExcludingModule(moduleName);
147+
moduleName = GetNiceDisplayNameForModule(moduleName);
146148

147149
message.message += string.Format("Enable the built in package '{0}' in the Package Manager window to fix this error.", moduleName);
148150
}

Modules/IMGUI/GUISkin.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,19 @@ static internal void CleanupRoots()
196196
public GUISettings settings { get { return m_Settings; } }
197197

198198
internal static GUIStyle ms_Error;
199-
internal static GUIStyle error { get { if (ms_Error == null) ms_Error = new GUIStyle(); return ms_Error; } }
199+
200+
internal static GUIStyle error
201+
{
202+
get
203+
{
204+
if (ms_Error == null)
205+
{
206+
ms_Error = new GUIStyle();
207+
ms_Error.name = "StyleNotFoundError";
208+
}
209+
return ms_Error;
210+
}
211+
}
200212

201213
private Dictionary<string, GUIStyle> m_Styles = null;
202214

@@ -313,7 +325,7 @@ public GUIStyle GetStyle(string styleName)
313325
GUIStyle s = FindStyle(styleName);
314326
if (s != null)
315327
return s;
316-
Debug.LogWarning("Unable to find style '" + styleName + "' in skin '" + name + "' " + Event.current.type);
328+
Debug.LogWarning("Unable to find style '" + styleName + "' in skin '" + name + "' " + (Event.current != null ? Event.current.type.ToString() : "<called outside OnGUI>"));
317329
return error;
318330
}
319331

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Unity 2018.2.10f1 C# reference source code
1+
## Unity 2018.2.11f1 C# reference source code
22

33
The C# part of the Unity engine and editor source code.
44
May be used for reference purposes only.

artifacts/generated/bindings_old/common/Editor/ModuleMetadataBindings.gen.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ public static UnityType[] GetModuleTypes(string moduleName)
5454
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
5555
extern internal static ModuleIncludeSetting GetModuleIncludeSettingForObject (Object o) ;
5656

57+
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
58+
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
59+
extern internal static string GetExcludingModuleForObject (Object o) ;
60+
61+
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
62+
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
63+
extern internal static string GetExcludingModule (string module) ;
64+
5765
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
5866
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
5967
extern internal static uint[] GetModuleTypeIndices (string moduleName) ;

artifacts/generated/bindings_old/common/Editor/PlayerSettingsSwitchBindings.gen.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,16 @@ public extern static bool isDataLossConfirmation
571571
set;
572572
}
573573

574+
public extern static bool isUserAccountLockEnabled
575+
{
576+
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
577+
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
578+
get;
579+
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
580+
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
581+
set;
582+
}
583+
574584
public extern static Switch.SupportedNpadStyle supportedNpadStyles
575585
{
576586
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration

0 commit comments

Comments
 (0)