Skip to content

Commit 087254d

Browse files
author
Unity Technologies
committed
Unity 2018.3.0a10 C# reference source code
1 parent 555f53c commit 087254d

File tree

104 files changed

+2128
-1111
lines changed

Some content is hidden

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

104 files changed

+2128
-1111
lines changed

Editor/Mono/AssetDatabase/AssetDatabaseSearching.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ public static string[] FindAssets(string filter)
1919

2020
public static string[] FindAssets(string filter, string[] searchInFolders)
2121
{
22-
SearchFilter searchFilter = new SearchFilter();
22+
var searchFilter = new SearchFilter { searchArea = SearchFilter.SearchArea.AllAssets };
2323
SearchUtility.ParseSearchString(filter, searchFilter);
24-
if (searchInFolders != null)
24+
if (searchInFolders != null && searchInFolders.Length > 0)
2525
{
2626
searchFilter.folders = searchInFolders;
2727
searchFilter.searchArea = SearchFilter.SearchArea.SelectedFolders;

Editor/Mono/BuildPipeline/AssemblyStripper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ private static void RunAssemblyStripper(IEnumerable assemblies, string managedAs
263263
string error;
264264
var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(platformProvider.target);
265265
bool isMono = PlayerSettings.GetScriptingBackend(buildTargetGroup) == ScriptingImplementation.Mono2x;
266-
bool stripEngineCode = rcr != null && PlayerSettings.stripEngineCode && platformProvider.supportsEngineStripping;
266+
bool stripEngineCode = rcr != null && PlayerSettings.stripEngineCode && platformProvider.supportsEngineStripping && !EditorUserBuildSettings.buildScriptsOnly;
267267
IEnumerable<string> blacklists = Il2CppBlacklistPaths;
268268
if (rcr != null)
269269
{
@@ -414,11 +414,11 @@ private static string GetMethodPreserveBlacklistContents(RuntimeClassRegistry rc
414414
return sb.ToString();
415415
}
416416

417-
static public void InvokeFromBuildPlayer(BuildTarget buildTarget, RuntimeClassRegistry usedClasses, ManagedStrippingLevel managedStrippingLevel)
417+
static public void InvokeFromBuildPlayer(BuildTarget buildTarget, RuntimeClassRegistry usedClasses, ManagedStrippingLevel managedStrippingLevel, BuildReport report)
418418
{
419419
var stagingAreaData = Paths.Combine("Temp", "StagingArea", "Data");
420420

421-
var platformProvider = new BaseIl2CppPlatformProvider(buildTarget, Path.Combine(stagingAreaData, "Libraries"));
421+
var platformProvider = new BaseIl2CppPlatformProvider(buildTarget, Path.Combine(stagingAreaData, "Libraries"), report);
422422

423423
var managedAssemblyFolderPath = Path.GetFullPath(Path.Combine(stagingAreaData, "Managed"));
424424
AssemblyStripper.StripAssemblies(managedAssemblyFolderPath, platformProvider, usedClasses, managedStrippingLevel);

Editor/Mono/BuildPipeline/CodeStrippingUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public static void WriteModuleAndClassRegistrationFile(string strippedAssemblyDi
254254
HashSet<UnityType> nativeClasses;
255255
HashSet<string> nativeModules;
256256
// by default, we only care about il2cpp
257-
bool doStripping = PlayerSettings.stripEngineCode;
257+
bool doStripping = PlayerSettings.stripEngineCode && !EditorUserBuildSettings.buildScriptsOnly;
258258
GenerateDependencies(strippedAssemblyDir, icallsListFile, rcr, doStripping, out nativeClasses, out nativeModules, platformProvider);
259259

260260
var outputClassRegistration = Path.Combine(outputDir, "UnityClassRegistration.cpp");

Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ internal static bool UseIl2CppCodegenWithMonoBackend(BuildTargetGroup targetGrou
111111
PlayerSettings.GetScriptingBackend(targetGroup) == ScriptingImplementation.IL2CPP;
112112
}
113113

114-
internal static bool EnableIL2CPPDebugger(BuildTargetGroup targetGroup)
114+
internal static bool EnableIL2CPPDebugger(IIl2CppPlatformProvider provider, BuildTargetGroup targetGroup)
115115
{
116-
if (!EditorUserBuildSettings.allowDebugging || !EditorUserBuildSettings.development)
116+
if (!provider.allowDebugging || !provider.development)
117117
return false;
118118

119119
switch (PlayerSettings.GetApiCompatibilityLevel(targetGroup))
@@ -276,7 +276,7 @@ private void ConvertPlayerDlltoCpp(string inputDirectory, string outputDirectory
276276

277277
arguments.Add(string.Format("--dotnetprofile=\"{0}\"", IL2CPPUtils.ApiCompatibilityLevelToDotNetProfileArgument(PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup))));
278278

279-
if (IL2CPPUtils.EnableIL2CPPDebugger(buildTargetGroup) && platformSupportsManagedDebugging)
279+
if (IL2CPPUtils.EnableIL2CPPDebugger(m_PlatformProvider, buildTargetGroup) && platformSupportsManagedDebugging)
280280
arguments.Add("--enable-debugger");
281281

282282
var il2CppNativeCodeBuilder = m_PlatformProvider.CreateIl2CppNativeCodeBuilder();
@@ -422,6 +422,8 @@ internal interface IIl2CppPlatformProvider
422422
bool supportsEngineStripping { get; }
423423
bool supportsManagedDebugging { get; }
424424
bool supportsUsingIl2cppCore { get; }
425+
bool development { get; }
426+
bool allowDebugging { get; }
425427

426428
BuildReport buildReport { get; }
427429
string[] includePaths { get; }
@@ -434,10 +436,11 @@ internal interface IIl2CppPlatformProvider
434436

435437
internal class BaseIl2CppPlatformProvider : IIl2CppPlatformProvider
436438
{
437-
public BaseIl2CppPlatformProvider(BuildTarget target, string libraryFolder)
439+
public BaseIl2CppPlatformProvider(BuildTarget target, string libraryFolder, BuildReport buildReport)
438440
{
439441
this.target = target;
440442
this.libraryFolder = libraryFolder;
443+
this.buildReport = buildReport;
441444
}
442445

443446
public virtual BuildTarget target { get; private set; }
@@ -480,11 +483,28 @@ public virtual bool supportsUsingIl2cppCore
480483
get { return true; }
481484
}
482485

483-
public virtual BuildReport buildReport
486+
public virtual bool development
484487
{
485-
get { return null; }
488+
get
489+
{
490+
if (buildReport != null)
491+
return (buildReport.summary.options & BuildOptions.Development) == BuildOptions.Development;
492+
return false;
493+
}
486494
}
487495

496+
public virtual bool allowDebugging
497+
{
498+
get
499+
{
500+
if (buildReport != null)
501+
return (buildReport.summary.options & BuildOptions.AllowDebugging) == BuildOptions.AllowDebugging;
502+
return false;
503+
}
504+
}
505+
506+
public BuildReport buildReport { get; private set; }
507+
488508
public virtual string[] includePaths
489509
{
490510
get

Editor/Mono/Collab/Collab.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public static void SetVersionControl(IVersionControl instance)
167167
}
168168

169169
[UsedByNativeCode]
170-
static bool HasVersionControl()
170+
internal static bool HasVersionControl()
171171
{
172172
return s_VersionControlInstance != null;
173173
}
@@ -242,6 +242,18 @@ static bool SupportsAsyncChanges()
242242
}
243243
}
244244

245+
internal static CollabStates GetAssetState(string assetGuid, string assetPath)
246+
{
247+
if (s_VersionControlInstance != null)
248+
{
249+
return s_VersionControlInstance.GetAssetState(assetGuid, assetPath);
250+
}
251+
else
252+
{
253+
return instance.GetAssetState(assetGuid);
254+
}
255+
}
256+
245257
// Static constructor for Collab
246258
static Collab()
247259
{

Editor/Mono/Collab/CollabEditorHooks.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static Collab.CollabStates GetAssetState(String assetGuid)
4242
return Collab.CollabStates.kCollabNone;
4343
}
4444

45-
Collab.CollabStates assetState = Collab.instance.GetAssetState(assetGuid);
45+
Collab.CollabStates assetState = Collab.GetAssetState(assetGuid, AssetDatabase.GUIDToAssetPath(assetGuid));
4646
return assetState;
4747
}
4848
}

Editor/Mono/Collab/IVersionControl.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ internal interface IVersionControl
1212
void OnDisableVersionControl();
1313
ChangeItem[] GetChanges();
1414
void MergeDownloadedFiles(bool isFullDownload);
15+
Collab.CollabStates GetAssetState(string assetGuid, string assetPath);
1516
}
1617
}

Editor/Mono/GUI/SubToolbar.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Unity C# reference source
2+
// Copyright (c) Unity Technologies. For terms of use, see
3+
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
4+
5+
using UnityEngine;
6+
7+
namespace UnityEditor
8+
{
9+
class SubToolbar
10+
{
11+
public float Width { get; set; }
12+
13+
public virtual void OnGUI(Rect rect)
14+
{
15+
}
16+
}
17+
} // namespace

0 commit comments

Comments
 (0)