Skip to content

Commit 3b1c055

Browse files
author
Unity Technologies
committed
Unity 6000.1.0a6 C# reference source code
1 parent 18d6ef1 commit 3b1c055

File tree

66 files changed

+1135
-593
lines changed

Some content is hidden

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

66 files changed

+1135
-593
lines changed

Editor/Mono/BuildTarget.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public enum BuildTarget
2121
[System.Obsolete("StandaloneOSXIntel has been removed in 2017.3")]
2222
StandaloneOSXIntel = 4,
2323

24-
// Build a Windows standalone.
24+
// Build a 32 bit Windows standalone.
2525
StandaloneWindows = 5,
2626

2727
// *undocumented*
@@ -56,7 +56,7 @@ public enum BuildTarget
5656
[System.Obsolete("StandaloneLinux has been removed in 2019.2")]
5757
StandaloneLinux = 17,
5858

59-
// Build a Windows x86_64 standalone.
59+
// Build a Windows standalone.
6060
StandaloneWindows64 = 19,
6161

6262
// *undocumented*

Editor/Mono/EditorGUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public sealed partial class EditorGUI
3838
{
3939
private static RecycledTextEditor activeEditor;
4040

41-
private static DelayedTextEditor s_DelayedTextEditorInternal;
41+
internal static DelayedTextEditor s_DelayedTextEditorInternal;
4242
internal static DelayedTextEditor s_DelayedTextEditor => s_DelayedTextEditorInternal ??= new();
4343

4444
internal static RecycledTextEditor s_RecycledEditorInternal;

Editor/Mono/GUI/WindowLayout.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,9 @@ public static void Maximize(EditorWindow win)
11261126
public static bool MaximizePrepare(EditorWindow win)
11271127
{
11281128
View rootSplit = FindRootSplitView(win);
1129+
//Some windows such as pop up windows might not have a split view
1130+
if (rootSplit == null)
1131+
return false;
11291132
View itor = rootSplit.parent;
11301133

11311134
// Make sure it has a dockarea

Editor/Mono/Inspector/CameraEditor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ internal static class Styles
3030
public static readonly GUIContent iconRemove = EditorGUIUtility.TrIconContent("Toolbar Minus", "Remove command buffer");
3131
public static readonly GUIContent clearFlags = EditorGUIUtility.TrTextContent("Clear Flags", "What to display in empty areas of this Camera's view.\n\nChoose Skybox to display a skybox in empty areas, defaulting to a background color if no skybox is found.\n\nChoose Solid Color to display a background color in empty areas.\n\nChoose Depth Only to display nothing in empty areas.\n\nChoose Don't Clear to display whatever was displayed in the previous frame in empty areas.");
3232
public static readonly GUIContent background = EditorGUIUtility.TrTextContent("Background", "The Camera clears the screen to this color before rendering.");
33+
public static readonly GUIContent cullingMask = EditorGUIUtility.TrTextContent("Culling Mask");
3334
public static readonly GUIContent projection = EditorGUIUtility.TrTextContent("Projection", "How the Camera renders perspective.\n\nChoose Perspective to render objects with perspective.\n\nChoose Orthographic to render objects uniformly, with no sense of perspective.");
3435
public static readonly GUIContent size = EditorGUIUtility.TrTextContent("Size", "The vertical size of the camera view.");
3536
public static readonly GUIContent fieldOfView = EditorGUIUtility.TrTextContent("Field of View", "The camera's view angle measured in degrees along the selected axis.");
@@ -972,7 +973,7 @@ public override VisualElement CreateInspectorGUI()
972973

973974
var clearFlags = ExtendedQuery<PropertyField>(editor, Styles.k_ClearFlagsElementName, Styles.clearFlags);
974975
var backgroundColor = ExtendedQuery<PropertyField>(editor, Styles.k_BackgroundElementName, Styles.background);
975-
ExtendedQuery<PropertyField>(editor, Styles.k_CullingMaskElementName, Styles.allowOcclusionCulling);
976+
ExtendedQuery<PropertyField>(editor, Styles.k_CullingMaskElementName, Styles.cullingMask);
976977

977978
var backgroundCheck = UIElementsEditorUtility.CreateDynamicVisibilityCallback(backgroundColor, () => showBackgroundColorOptions);
978979
clearFlags.RegisterValueChangeCallback(e => backgroundCheck.Invoke());

Editor/Mono/Inspector/LightProbeGroupInspector.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,9 @@ public LightProbeGroupOverlay(LightProbeGroup target, LightProbeGroupEditor edit
551551
m_Editor = editor;
552552

553553
displayName = "Edit Light Probes";
554+
collapsedIcon = EditorGUIUtility.LoadIcon("EditCollider");
555+
556+
displayedChanged += value => m_Visible = value;
554557
}
555558

556559
public override void OnGUI()
@@ -633,7 +636,8 @@ Vector3 CalculateDeltaAndClamp(Vector3 vec1, Vector3 vec2)
633636
return vec1 - vec2;
634637
}
635638

636-
public override bool visible => true;
639+
public override bool visible => m_Visible;
640+
private bool m_Visible = true;
637641
}
638642

639643
[EditorTool("Light Probe Group", typeof(LightProbeGroup))]

Editor/Mono/ObjectSelector.cs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,18 @@ int GetSelectedInstanceID()
169169
return m_LastSelectedInstanceId;
170170
}
171171

172+
void SetSelectedInstanceID(int instanceID)
173+
{
174+
m_LastSelectedInstanceId = instanceID;
175+
if (m_ListArea == null)
176+
return;
177+
178+
if (instanceID != 0)
179+
m_ListArea.m_SelectedObjectIcon = AssetDatabase.GetCachedIcon(AssetDatabase.GetAssetPath(instanceID));
180+
else
181+
m_ListArea.m_SelectedObjectIcon = null;
182+
}
183+
172184
[UsedImplicitly]
173185
void OnEnable()
174186
{
@@ -229,8 +241,7 @@ public void SetupPreview()
229241

230242
void ListAreaItemSelectedCallback(bool doubleClicked)
231243
{
232-
m_LastSelectedInstanceId = GetInternalSelectedInstanceID();
233-
m_ListArea.m_SelectedObjectIcon = AssetDatabase.GetCachedIcon(AssetDatabase.GetAssetPath(m_LastSelectedInstanceId));
244+
SetSelectedInstanceID(GetInternalSelectedInstanceID());
234245

235246
if (doubleClicked)
236247
{
@@ -455,7 +466,7 @@ internal void Show(UnityObject obj, Type[] requiredTypes, UnityObject objectBein
455466
m_SkipHiddenPackages = true;
456467
m_AllowedIDs = allowedInstanceIDs;
457468
m_ObjectBeingEdited = objectBeingEdited;
458-
m_LastSelectedInstanceId = obj?.GetInstanceID() ?? 0;
469+
SetSelectedInstanceID(obj?.GetInstanceID() ?? 0);
459470
m_SelectionCancelled = false;
460471
m_ShowNoneItem = showNoneItem;
461472

@@ -522,7 +533,7 @@ internal void Show(UnityObject obj, Type[] requiredTypes, UnityObject objectBein
522533

523534
Action<UnityObject> onSelectionChanged = selectedObj =>
524535
{
525-
m_LastSelectedInstanceId = selectedObj == null ? 0 : selectedObj.GetInstanceID();
536+
SetSelectedInstanceID(selectedObj == null ? 0 : selectedObj.GetInstanceID());
526537
NotifySelectionChanged(false);
527538
};
528539
Action<UnityObject, bool> onSelectorClosed = (selectedObj, canceled) =>
@@ -532,12 +543,12 @@ internal void Show(UnityObject obj, Type[] requiredTypes, UnityObject objectBein
532543
{
533544
// Undo changes we have done in the ObjectSelector
534545
Undo.RevertAllDownToGroup(m_ModalUndoGroup);
535-
m_LastSelectedInstanceId = 0;
546+
SetSelectedInstanceID(0);
536547
m_SelectionCancelled = true;
537548
}
538549
else
539550
{
540-
m_LastSelectedInstanceId = selectedObj == null ? 0 : selectedObj.GetInstanceID();
551+
SetSelectedInstanceID(selectedObj == null ? 0 : selectedObj.GetInstanceID());
541552
NotifySelectionChanged(false);
542553
}
543554

@@ -658,7 +669,7 @@ void CreateAndSetTreeView(ObjectTreeForSelector.TreeSelectorData data)
658669

659670
void TreeViewSelection(TreeViewItem item)
660671
{
661-
m_LastSelectedInstanceId = GetInternalSelectedInstanceID();
672+
SetSelectedInstanceID(GetInternalSelectedInstanceID());
662673
NotifySelectionChanged(true);
663674
}
664675

@@ -682,6 +693,8 @@ void InitIfNeeded()
682693
m_ListArea.itemSelectedCallback += ListAreaItemSelectedCallback;
683694
m_ListArea.gridSize = m_StartGridSize.value;
684695

696+
SetSelectedInstanceID(m_LastSelectedInstanceId);
697+
685698
FilterSettingsChanged();
686699
}
687700
}
@@ -1022,7 +1035,7 @@ internal void Cancel()
10221035
// Clear selection so that object field doesn't grab it
10231036
m_ListArea?.InitSelection(new int[0]);
10241037
m_ObjectTreeWithSearch.Clear();
1025-
m_LastSelectedInstanceId = 0;
1038+
SetSelectedInstanceID(0);
10261039
m_SelectionCancelled = true;
10271040
m_EditedProperty = null;
10281041

Editor/Mono/ScriptReloadProperties.cs

Lines changed: 53 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ internal struct MonoReloadableIntPtrClear
2626
internal sealed class ScriptReloadProperties : ScriptableObject
2727
{
2828
public bool EditorGUI_IsActuallEditing;
29+
public bool EditorGUI_TextEditor_needBackup;
2930
public int EditorGUI_TextEditor_cursorIndex;
3031
public int EditorGUI_TextEditor_selectIndex;
3132
public int EditorGUI_TextEditor_controlID;
@@ -35,7 +36,7 @@ internal sealed class ScriptReloadProperties : ScriptableObject
3536
public Vector2 EditorGUI_TextEditor_graphicalCursorPos;
3637
public string EditorGUI_TextEditor_content;
3738
public string EditorGUI_Current_Editing_String;
38-
39+
private bool EditorGUI_DelayedTextEditor_needBackup;
3940
public int EditorGUI_DelayedTextEditor_cursorIndex;
4041
public int EditorGUI_DelayedTextEditor_selectIndex;
4142
public int EditorGUI_DelayedTextEditor_controlID;
@@ -64,47 +65,64 @@ static void Load(ScriptReloadProperties properties)
6465
private void ManagedStore()
6566
{
6667
EditorGUI_IsActuallEditing = EditorGUI.RecycledTextEditor.s_ActuallyEditing;
67-
EditorGUI_TextEditor_cursorIndex = EditorGUI.s_RecycledEditor.cursorIndex;
68-
EditorGUI_TextEditor_selectIndex = EditorGUI.s_RecycledEditor.selectIndex;
69-
EditorGUI_TextEditor_controlID = EditorGUI.s_RecycledEditor.controlID;
70-
EditorGUI_TextEditor_hasHorizontalCursorPos = EditorGUI.s_RecycledEditor.hasHorizontalCursor;
71-
EditorGUI_TextEditor_scrollOffset = EditorGUI.s_RecycledEditor.scrollOffset;
72-
EditorGUI_TextEditor_hasFocus = EditorGUI.s_RecycledEditor.m_HasFocus;
73-
EditorGUI_TextEditor_graphicalCursorPos = EditorGUI.s_RecycledEditor.graphicalCursorPos;
74-
EditorGUI_TextEditor_content = EditorGUI.s_RecycledEditor.text;
68+
69+
EditorGUI_TextEditor_needBackup = EditorGUI.s_RecycledEditorInternal != null;
70+
if (EditorGUI_TextEditor_needBackup)
71+
{
72+
EditorGUI_TextEditor_cursorIndex = EditorGUI.s_RecycledEditor.cursorIndex;
73+
EditorGUI_TextEditor_selectIndex = EditorGUI.s_RecycledEditor.selectIndex;
74+
EditorGUI_TextEditor_controlID = EditorGUI.s_RecycledEditor.controlID;
75+
EditorGUI_TextEditor_hasHorizontalCursorPos = EditorGUI.s_RecycledEditor.hasHorizontalCursor;
76+
EditorGUI_TextEditor_scrollOffset = EditorGUI.s_RecycledEditor.scrollOffset;
77+
EditorGUI_TextEditor_hasFocus = EditorGUI.s_RecycledEditor.m_HasFocus;
78+
EditorGUI_TextEditor_graphicalCursorPos = EditorGUI.s_RecycledEditor.graphicalCursorPos;
79+
EditorGUI_TextEditor_content = EditorGUI.s_RecycledEditor.text;
80+
}
7581
EditorGUI_Current_Editing_String = EditorGUI.s_RecycledCurrentEditingString;
76-
EditorGUI_DelayedTextEditor_cursorIndex = EditorGUI.s_DelayedTextEditor.cursorIndex;
77-
EditorGUI_DelayedTextEditor_selectIndex = EditorGUI.s_DelayedTextEditor.selectIndex;
78-
EditorGUI_DelayedTextEditor_controlID = EditorGUI.s_DelayedTextEditor.controlID;
79-
EditorGUI_DelayedTextEditor_hasHorizontalCursorPos = EditorGUI.s_DelayedTextEditor.hasHorizontalCursor;
80-
EditorGUI_DelayedTextEditor_scrollOffset = EditorGUI.s_DelayedTextEditor.scrollOffset;
81-
EditorGUI_DelayedTextEditor_hasFocus = EditorGUI.s_DelayedTextEditor.m_HasFocus;
82-
EditorGUI_DelayedTextEditor_graphicalCursorPos = EditorGUI.s_DelayedTextEditor.graphicalCursorPos;
83-
EditorGUI_DelayedTextEditor_content = EditorGUI.s_DelayedTextEditor.text;
84-
EditorGUI_DelayedControlThatHadFocusValue = EditorGUI.s_DelayedTextEditor.controlThatHadFocusValue;
82+
83+
EditorGUI_DelayedTextEditor_needBackup = EditorGUI.s_DelayedTextEditorInternal != null;
84+
if(EditorGUI_DelayedTextEditor_needBackup)
85+
{
86+
EditorGUI_DelayedTextEditor_cursorIndex = EditorGUI.s_DelayedTextEditor.cursorIndex;
87+
EditorGUI_DelayedTextEditor_selectIndex = EditorGUI.s_DelayedTextEditor.selectIndex;
88+
EditorGUI_DelayedTextEditor_controlID = EditorGUI.s_DelayedTextEditor.controlID;
89+
EditorGUI_DelayedTextEditor_hasHorizontalCursorPos = EditorGUI.s_DelayedTextEditor.hasHorizontalCursor;
90+
EditorGUI_DelayedTextEditor_scrollOffset = EditorGUI.s_DelayedTextEditor.scrollOffset;
91+
EditorGUI_DelayedTextEditor_hasFocus = EditorGUI.s_DelayedTextEditor.m_HasFocus;
92+
EditorGUI_DelayedTextEditor_graphicalCursorPos = EditorGUI.s_DelayedTextEditor.graphicalCursorPos;
93+
EditorGUI_DelayedTextEditor_content = EditorGUI.s_DelayedTextEditor.text;
94+
EditorGUI_DelayedControlThatHadFocusValue = EditorGUI.s_DelayedTextEditor.controlThatHadFocusValue;
95+
}
8596
}
8697

8798
private void ManagedLoad()
8899
{
89-
EditorGUI.s_RecycledEditor.text = EditorGUI_TextEditor_content;
90100
EditorGUI.s_RecycledCurrentEditingString = EditorGUI_Current_Editing_String;
91101
EditorGUI.RecycledTextEditor.s_ActuallyEditing = EditorGUI_IsActuallEditing;
92-
EditorGUI.s_RecycledEditor.cursorIndex = EditorGUI_TextEditor_cursorIndex;
93-
EditorGUI.s_RecycledEditor.selectIndex = EditorGUI_TextEditor_selectIndex;
94-
EditorGUI.s_RecycledEditor.controlID = EditorGUI_TextEditor_controlID;
95-
EditorGUI.s_RecycledEditor.hasHorizontalCursor = EditorGUI_TextEditor_hasHorizontalCursorPos;
96-
EditorGUI.s_RecycledEditor.scrollOffset = EditorGUI_TextEditor_scrollOffset;
97-
EditorGUI.s_RecycledEditor.m_HasFocus = EditorGUI_TextEditor_hasFocus;
98-
EditorGUI.s_RecycledEditor.graphicalCursorPos = EditorGUI_TextEditor_graphicalCursorPos;
99-
EditorGUI.s_DelayedTextEditor.text = EditorGUI_DelayedTextEditor_content;
100-
EditorGUI.s_DelayedTextEditor.cursorIndex = EditorGUI_DelayedTextEditor_cursorIndex;
101-
EditorGUI.s_DelayedTextEditor.selectIndex = EditorGUI_DelayedTextEditor_selectIndex;
102-
EditorGUI.s_DelayedTextEditor.controlID = EditorGUI_DelayedTextEditor_controlID;
103-
EditorGUI.s_DelayedTextEditor.hasHorizontalCursor = EditorGUI_DelayedTextEditor_hasHorizontalCursorPos;
104-
EditorGUI.s_DelayedTextEditor.scrollOffset = EditorGUI_DelayedTextEditor_scrollOffset;
105-
EditorGUI.s_DelayedTextEditor.m_HasFocus = EditorGUI_DelayedTextEditor_hasFocus;
106-
EditorGUI.s_DelayedTextEditor.graphicalCursorPos = EditorGUI_DelayedTextEditor_graphicalCursorPos;
107-
EditorGUI.s_DelayedTextEditor.controlThatHadFocusValue = EditorGUI_DelayedControlThatHadFocusValue;
102+
if (EditorGUI_TextEditor_needBackup)
103+
{
104+
EditorGUI.s_RecycledEditor.text = EditorGUI_TextEditor_content;
105+
EditorGUI.s_RecycledEditor.cursorIndex = EditorGUI_TextEditor_cursorIndex;
106+
EditorGUI.s_RecycledEditor.selectIndex = EditorGUI_TextEditor_selectIndex;
107+
EditorGUI.s_RecycledEditor.controlID = EditorGUI_TextEditor_controlID;
108+
EditorGUI.s_RecycledEditor.hasHorizontalCursor = EditorGUI_TextEditor_hasHorizontalCursorPos;
109+
EditorGUI.s_RecycledEditor.scrollOffset = EditorGUI_TextEditor_scrollOffset;
110+
EditorGUI.s_RecycledEditor.m_HasFocus = EditorGUI_TextEditor_hasFocus;
111+
EditorGUI.s_RecycledEditor.graphicalCursorPos = EditorGUI_TextEditor_graphicalCursorPos;
112+
}
113+
114+
if (EditorGUI_DelayedTextEditor_needBackup)
115+
{
116+
EditorGUI.s_DelayedTextEditor.text = EditorGUI_DelayedTextEditor_content;
117+
EditorGUI.s_DelayedTextEditor.cursorIndex = EditorGUI_DelayedTextEditor_cursorIndex;
118+
EditorGUI.s_DelayedTextEditor.selectIndex = EditorGUI_DelayedTextEditor_selectIndex;
119+
EditorGUI.s_DelayedTextEditor.controlID = EditorGUI_DelayedTextEditor_controlID;
120+
EditorGUI.s_DelayedTextEditor.hasHorizontalCursor = EditorGUI_DelayedTextEditor_hasHorizontalCursorPos;
121+
EditorGUI.s_DelayedTextEditor.scrollOffset = EditorGUI_DelayedTextEditor_scrollOffset;
122+
EditorGUI.s_DelayedTextEditor.m_HasFocus = EditorGUI_DelayedTextEditor_hasFocus;
123+
EditorGUI.s_DelayedTextEditor.graphicalCursorPos = EditorGUI_DelayedTextEditor_graphicalCursorPos;
124+
EditorGUI.s_DelayedTextEditor.controlThatHadFocusValue = EditorGUI_DelayedControlThatHadFocusValue;
125+
}
108126
}
109127
}
110128
}

Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,14 +861,21 @@ public CompileStatus CompileScriptsWithSettings(ScriptAssemblySettings scriptAss
861861
? Constants.ScriptAssembliesAndTypeDBTarget
862862
: Constants.ScriptAssembliesTarget;
863863

864+
var extraScriptingDefines = new List<string>();
865+
if(scriptAssemblySettings.BuildingForEditor)
866+
extraScriptingDefines.Add("UNITY_EDITOR");
867+
if(scriptAssemblySettings.BuildingDevelopmentBuild)
868+
extraScriptingDefines.Add("DEVELOPMENT_BUILD");
869+
864870
buildRequest.DataForBuildProgram.Add(() => BeeScriptCompilation.ScriptCompilationDataFor(
865871
this,
866872
scriptAssemblies,
867873
debug,
868874
scriptAssemblySettings.OutputDirectory,
869875
buildTarget,
870876
scriptAssemblySettings.BuildingForEditor,
871-
!scriptAssemblySettings.BuildingWithoutScriptUpdater));
877+
!scriptAssemblySettings.BuildingWithoutScriptUpdater,
878+
extraScriptingDefines.ToArray()));
872879

873880
var cts = new CancellationTokenSource();
874881

Editor/Mono/SettingsWindow/FogEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public override void OnInspectorGUI()
6363

6464
if ((FogMode)m_FogMode.intValue != FogMode.Linear)
6565
{
66-
EditorGUILayout.PropertyField(m_FogDensity, Styles.FogDensity);
66+
EditorGUILayout.Slider(m_FogDensity, 0.0f, 1.0f, Styles.FogDensity);
6767
}
6868
else
6969
{

Modules/DeviceSimulatorEditor/DeviceInfo/DeviceInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ internal class GraphicsSystemInfoData
114114
public RenderingThreadingMode renderingThreadingMode;
115115
public FoveatedRenderingCaps foveatedRenderingCaps;
116116
public bool supportsVariableRateShading;
117+
public bool hasTiledGPU;
117118
public bool hasHiddenSurfaceRemovalOnGPU;
118119
public bool hasDynamicUniformArrayIndexingInFragmentShaders;
119120
public bool supportsShadows;

0 commit comments

Comments
 (0)