Skip to content

Commit 0b34d6c

Browse files
author
Unity Technologies
committed
Unity 2021.1.0a5 C# reference source code
1 parent 6b8303f commit 0b34d6c

File tree

285 files changed

+35585
-4831
lines changed

Some content is hidden

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

285 files changed

+35585
-4831
lines changed

Editor/Mono/2D/SpriteAtlas/SpriteAtlasAsset.bindings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static void Save(SpriteAtlasAsset asset, string assetPath)
5858
if (asset == null)
5959
throw new ArgumentNullException("Parameter asset is null");
6060
var objs = new UnityEngine.Object[] { asset };
61-
UnityEditorInternal.InternalEditorUtility.SaveToSerializedFileAndForget(objs, assetPath, true);
61+
UnityEditorInternal.InternalEditorUtility.SaveToSerializedFileAndForget(objs, assetPath, UnityEditor.EditorSettings.serializationMode != UnityEditor.SerializationMode.ForceBinary);
6262
}
6363
}
6464
};

Editor/Mono/2D/SpriteAtlas/SpriteAtlasImporterInspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ protected void Apply()
369369
if (HasModified())
370370
{
371371
serializedAssetObject.ApplyModifiedPropertiesWithoutUndo();
372-
InternalEditorUtility.SaveToSerializedFileAndForget(new Object[] { spriteAtlasAsset }, m_AssetPath, true);
372+
SpriteAtlasAsset.Save(spriteAtlasAsset, m_AssetPath);
373373
}
374374
}
375375

Editor/Mono/Annotation/LayerVisibilityWindow.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ private class Styles
1717
public readonly GUIStyle listEvenBg = "ObjectPickerResultsOdd";
1818
public readonly GUIStyle listOddBg = "ObjectPickerResultsEven";
1919
public readonly GUIStyle separator = "sv_iconselector_sep";
20-
public readonly GUIStyle lockButton = "IN LockButton";
2120
public readonly GUIStyle listTextStyle;
2221
public readonly GUIStyle listHeaderStyle;
23-
public readonly Texture2D visibleOn = EditorGUIUtility.LoadIcon("animationvisibilitytoggleon");
22+
public readonly Texture2D visibleOn = EditorGUIUtility.LoadIcon("animationvisibilitytoggleon");
2423
public readonly Texture2D visibleOff = EditorGUIUtility.LoadIcon("animationvisibilitytoggleoff");
24+
public readonly Texture2D pickable = EditorGUIUtility.LoadIcon("scenepicking_pickable");
25+
public readonly Texture2D notpickable = EditorGUIUtility.LoadIcon("scenepicking_notpickable");
2526
public readonly GUIContent editLayers = EditorGUIUtility.TrTextContent("Edit Layers...");
2627
public Styles()
2728
{
@@ -39,7 +40,7 @@ public Styles()
3940
const float kToggleSize = 17;
4041
const float kSeparatorHeight = 6;
4142
const string kLayerVisible = "Show/Hide Layer";
42-
const string kLayerLocked = "Lock Layer for Picking";
43+
const string kLayerPickable = "Toggle Pickable status this Layer. Non-Pickable items cannot be selected in the Scene View.";
4344

4445
private static LayerVisibilityWindow s_LayerVisibilityWindow;
4546
private static long s_LastClosedTime;
@@ -271,7 +272,7 @@ void DoOneSortingLayer(Rect rect, int index, ref bool even)
271272
even = !even;
272273
}
273274

274-
private void DoLayerEntry(Rect rect, string layerName, bool even, bool showVisible, bool showLock, bool visible, bool locked, out bool visibleChanged, out bool lockedChanged)
275+
private void DoLayerEntry(Rect rect, string layerName, bool even, bool showVisible, bool showLock, bool visible, bool picked, out bool visibleChanged, out bool lockedChanged)
275276
{
276277
DrawListBackground(rect, even);
277278

@@ -287,7 +288,6 @@ private void DoLayerEntry(Rect rect, string layerName, bool even, bool showVisib
287288
if (showVisible)
288289
{
289290
var iconRect = toggleRect;
290-
iconRect.y += 3;
291291
var gc = new GUIContent(string.Empty, visible ? s_Styles.visibleOn : s_Styles.visibleOff, kLayerVisible);
292292
GUI.Toggle(iconRect, visible, gc, GUIStyle.none);
293293
visibleChanged = EditorGUI.EndChangeCheck();
@@ -299,7 +299,8 @@ private void DoLayerEntry(Rect rect, string layerName, bool even, bool showVisib
299299
{
300300
toggleRect.x += kToggleSize;
301301
EditorGUI.BeginChangeCheck();
302-
GUI.Toggle(toggleRect, locked, new GUIContent(string.Empty, kLayerLocked), s_Styles.lockButton);
302+
var gc = new GUIContent(string.Empty, picked ? s_Styles.notpickable : s_Styles.pickable, kLayerPickable);
303+
GUI.Toggle(toggleRect, picked, gc, GUIStyle.none);
303304
lockedChanged = EditorGUI.EndChangeCheck();
304305
}
305306
}

Editor/Mono/AssemblyInfo/AssemblyInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
[assembly: InternalsVisibleTo("Unity.XR.Remoting.Editor")]
108108
[assembly: InternalsVisibleTo("UnityEngine.Common")]
109109
[assembly: InternalsVisibleTo("Unity.UI.Builder.Editor")]
110+
[assembly: InternalsVisibleTo("UnityEditor.UIBuilderModule")]
110111
[assembly: InternalsVisibleTo("Unity.UI.Builder.EditorTests")]
111112
[assembly: InternalsVisibleTo("Unity.GraphViewTestUtilities.Editor")]
112113
[assembly: InternalsVisibleTo("Unity.ProBuilder.Editor")]

Editor/Mono/AssetPostprocessor.cs

Lines changed: 1 addition & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,7 @@ static void PostprocessAllAssets(string[] importedAssets, string[] addedAssets,
103103
}
104104

105105
Profiler.BeginSample("SyncVS.PostprocessSyncProject");
106-
#pragma warning disable 618
107-
if (ScriptEditorUtility.GetScriptEditorFromPath(CodeEditor.CurrentEditorInstallation) == ScriptEditorUtility.ScriptEditor.Other
108-
|| ScriptEditorUtility.GetScriptEditorFromPath(CodeEditor.CurrentEditorInstallation) == ScriptEditorUtility.ScriptEditor.SystemDefault)
109-
{
110-
CodeEditorProjectSync.PostprocessSyncProject(importedAssets, addedAssets, deletedAssets, movedAssets, movedFromPathAssets);
111-
}
112-
else
113-
{
114-
///@TODO: we need addedAssets for SyncVS. Make this into a proper API and write tests
115-
SyncVS.PostprocessSyncProject(importedAssets, addedAssets, deletedAssets, movedAssets, movedFromPathAssets);
116-
}
106+
CodeEditorProjectSync.PostprocessSyncProject(importedAssets, addedAssets, deletedAssets, movedAssets, movedFromPathAssets);
117107
Profiler.EndSample();
118108
}
119109

@@ -126,67 +116,6 @@ static void PreprocessAssembly(string pathName)
126116
}
127117
}
128118

129-
//This is undocumented, and a "safeguard" for when visualstudio gets a new release that is incompatible with ours, so that users can postprocess our csproj to fix it.
130-
//(or just completely replace them). Hopefully we'll never need this.
131-
static internal void CallOnGeneratedCSProjectFiles()
132-
{
133-
object[] args = {};
134-
foreach (var method in AllPostProcessorMethodsNamed("OnGeneratedCSProjectFiles"))
135-
{
136-
InvokeMethod(method, args);
137-
}
138-
}
139-
140-
//This callback is used by C# code editors to modify the .sln file.
141-
static internal string CallOnGeneratedSlnSolution(string path, string content)
142-
{
143-
foreach (var method in AllPostProcessorMethodsNamed("OnGeneratedSlnSolution"))
144-
{
145-
object[] args = { path, content };
146-
object returnValue = InvokeMethod(method, args);
147-
148-
if (method.ReturnType == typeof(string))
149-
content = (string)returnValue;
150-
}
151-
152-
return content;
153-
}
154-
155-
// This callback is used by C# code editors to modify the .csproj files.
156-
static internal string CallOnGeneratedCSProject(string path, string content)
157-
{
158-
foreach (var method in AllPostProcessorMethodsNamed("OnGeneratedCSProject"))
159-
{
160-
object[] args = { path, content };
161-
object returnValue = InvokeMethod(method, args);
162-
163-
if (method.ReturnType == typeof(string))
164-
content = (string)returnValue;
165-
}
166-
167-
return content;
168-
}
169-
170-
//This callback is used by UnityVS to take over project generation from unity
171-
static internal bool OnPreGeneratingCSProjectFiles()
172-
{
173-
object[] args = {};
174-
bool result = false;
175-
foreach (var method in AllPostProcessorMethodsNamed("OnPreGeneratingCSProjectFiles"))
176-
{
177-
object returnValue = InvokeMethod(method, args);
178-
179-
if (method.ReturnType == typeof(bool))
180-
result = result | (bool)returnValue;
181-
}
182-
return result;
183-
}
184-
185-
private static IEnumerable<MethodInfo> AllPostProcessorMethodsNamed(string callbackName)
186-
{
187-
return GetCachedAssetPostprocessorClasses().Select(assetPostprocessorClass => assetPostprocessorClass.GetMethod(callbackName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static)).Where(method => method != null);
188-
}
189-
190119
internal class CompareAssetImportPriority : IComparer
191120
{
192121
int IComparer.Compare(System.Object xo, System.Object yo)

0 commit comments

Comments
 (0)