Skip to content

Commit 66ae70d

Browse files
author
Unity Technologies
committed
Unity 2023.1.0a9 C# reference source code
1 parent 6c247dc commit 66ae70d

165 files changed

Lines changed: 3474 additions & 1960 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/IncrementalBuildPipeline/PlayerBuildProgramLibrary.Data/Data.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public class PlayerBuildConfig
4646
public string PlayerPackage;
4747
public string ApplicationIdentifier;
4848
public string Architecture;
49-
public bool UseIl2Cpp;
50-
public bool UseCoreCLR;
49+
public ScriptingBackend ScriptingBackend;
5150
public bool InstallIntoBuildsFolder;
5251
public bool GenerateIdeProject;
5352
public bool Development;
@@ -97,6 +96,7 @@ public class Il2CppConfig
9796
public bool AllowDebugging;
9897
public string SysRootPath;
9998
public string ToolChainPath;
99+
public string RelativeDataPath;
100100
}
101101

102102
public class Services
@@ -112,4 +112,11 @@ public class StreamingAssetsFile
112112
public string File;
113113
public string RelativePath;
114114
}
115+
116+
public enum ScriptingBackend
117+
{
118+
Mono,
119+
IL2CPP,
120+
CoreCLR,
121+
}
115122
}

Editor/Mono/AssetPipeline/IHVImageFormatImporter.bindings.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,17 @@ public extern int streamingMipmapsPriority
7474
get;
7575
set;
7676
}
77+
78+
public extern bool ignoreMipmapLimit
79+
{
80+
get;
81+
set;
82+
}
83+
84+
public extern string mipmapLimitGroupName
85+
{
86+
get;
87+
set;
88+
}
7789
}
7890
}

Editor/Mono/AssetPipeline/TextureImporter.bindings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ public static bool IsDefaultPlatformTextureFormatValid(TextureImporterType textu
248248
[NativeProperty("VTOnly")]
249249
public extern bool vtOnly { get; set; }
250250

251-
internal extern bool ignoreMasterTextureLimit { get; set; }
251+
public extern bool ignoreMipmapLimit { get; set; }
252+
public extern string mipmapLimitGroupName { get; set; }
252253

253254
// Generate mip maps for the texture?
254255
public extern bool mipmapEnabled { get; set; }

Editor/Mono/AssetPipeline/TextureImporterTypes.bindings.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Runtime.InteropServices;
77
using UnityEngine;
88
using UnityEngine.Bindings;
9+
using UnityEngine.Serialization;
910

1011
namespace UnityEditor
1112
{
@@ -70,8 +71,8 @@ public sealed class TextureImporterSettings
7071

7172
[SerializeField]
7273
int m_VTOnly;
73-
[SerializeField]
74-
int m_IgnoreMasterTextureLimit;
74+
[SerializeField, FormerlySerializedAs("m_IgnoreMasterTextureLimit")]
75+
int m_IgnoreMipmapLimit;
7576

7677
[SerializeField]
7778
int m_NPOTScale;
@@ -347,10 +348,10 @@ public bool vtOnly
347348
get { return m_VTOnly != 0; }
348349
set { m_VTOnly = value ? 1 : 0; }
349350
}
350-
internal bool ignoreMasterTextureLimit
351+
public bool ignoreMipmapLimit
351352
{
352-
get { return m_IgnoreMasterTextureLimit != 0; }
353-
set { m_IgnoreMasterTextureLimit = value ? 1 : 0; }
353+
get { return m_IgnoreMipmapLimit != 0; }
354+
set { m_IgnoreMipmapLimit = value ? 1 : 0; }
354355
}
355356

356357
public TextureImporterNPOTScale npotScale

Editor/Mono/BuildPipeline.bindings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ public enum BuildOptions
125125
// The BuildReport object returned by BuildPipeline.BuildPlayer will contain more details (about build times and contents), at the cost of a slightly (typically, a few percents) longer build time
126126
DetailedBuildReport = 1 << 29,
127127

128-
// Turn shader stripping on and enable shader live link connection
129-
ShaderLivelinkSupport = 1 << 30,
128+
[Obsolete("Shader LiveLink is no longer supported.")]
129+
ShaderLivelinkSupport = 0,
130130

131131
}
132132

Editor/Mono/BuildPipeline/BuildPlatform.cs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ internal class BuildPlatform
1515
// short name used for texture settings, etc.
1616
public string name;
1717
public NamedBuildTarget namedBuildTarget;
18+
public bool installed;
1819
public bool hideInUi;
1920
public string tooltip;
2021
public BuildTarget defaultTarget;
@@ -28,12 +29,12 @@ internal class BuildPlatform
2829
public GUIContent title => m_Title;
2930
public Texture2D smallIcon => ((GUIContent)m_SmallTitle).image as Texture2D;
3031

31-
public BuildPlatform(string locTitle, string iconId, NamedBuildTarget namedBuildTarget, BuildTarget defaultTarget, bool hideInUi)
32-
: this(locTitle, "", iconId, namedBuildTarget, defaultTarget, hideInUi)
32+
public BuildPlatform(string locTitle, string iconId, NamedBuildTarget namedBuildTarget, BuildTarget defaultTarget, bool hideInUi, bool installed)
33+
: this(locTitle, "", iconId, namedBuildTarget, defaultTarget, hideInUi, installed)
3334
{
3435
}
3536

36-
public BuildPlatform(string locTitle, string tooltip, string iconId, NamedBuildTarget namedBuildTarget, BuildTarget defaultTarget, bool hideInUi)
37+
public BuildPlatform(string locTitle, string tooltip, string iconId, NamedBuildTarget namedBuildTarget, BuildTarget defaultTarget, bool hideInUi, bool installed)
3738
{
3839
this.namedBuildTarget = namedBuildTarget;
3940
name = namedBuildTarget.TargetName;
@@ -42,15 +43,16 @@ public BuildPlatform(string locTitle, string tooltip, string iconId, NamedBuildT
4243
this.tooltip = tooltip;
4344
this.hideInUi = hideInUi;
4445
this.defaultTarget = defaultTarget;
46+
this.installed = installed;
4547
}
4648
}
4749

4850
internal class BuildPlatformWithSubtarget : BuildPlatform
4951
{
5052
public int subtarget;
5153

52-
public BuildPlatformWithSubtarget(string locTitle, string tooltip, string iconId, NamedBuildTarget namedBuildTarget, BuildTarget defaultTarget, int subtarget, bool forceShowTarget)
53-
: base(locTitle, tooltip, iconId, namedBuildTarget, defaultTarget, forceShowTarget)
54+
public BuildPlatformWithSubtarget(string locTitle, string tooltip, string iconId, NamedBuildTarget namedBuildTarget, BuildTarget defaultTarget, int subtarget, bool hideInUi, bool installed)
55+
: base(locTitle, tooltip, iconId, namedBuildTarget, defaultTarget, hideInUi, installed)
5456
{
5557
this.subtarget = subtarget;
5658
name = namedBuildTarget.TargetName;
@@ -80,10 +82,13 @@ internal BuildPlatforms()
8082
standaloneTarget = BuildTarget.StandaloneLinux64;
8183

8284
buildPlatformsList.Add(new BuildPlatformWithSubtarget(BuildPipeline.GetBuildTargetGroupDisplayName(BuildTargetGroup.Standalone), "", "BuildSettings.Standalone",
83-
NamedBuildTarget.Standalone, standaloneTarget, (int)StandaloneBuildSubtarget.Player, true));
85+
NamedBuildTarget.Standalone, standaloneTarget, (int)StandaloneBuildSubtarget.Player, false, true));
8486

87+
// TODO: We should consider extend BuildTargetDiscovery to support named targets and subtargets,
88+
// specially if at some point other platforms use them.
89+
// The installed value is set by the linux, mac or win ExtensionModule.cs when they are loaded.
8590
buildPlatformsList.Add(new BuildPlatformWithSubtarget("Dedicated Server", "", "BuildSettings.DedicatedServer",
86-
NamedBuildTarget.Server, standaloneTarget, (int)StandaloneBuildSubtarget.Server, true));
91+
NamedBuildTarget.Server, standaloneTarget, (int)StandaloneBuildSubtarget.Server, false, false));
8792

8893
foreach (var target in buildTargets)
8994
{
@@ -95,7 +100,8 @@ internal BuildPlatforms()
95100
target.iconName,
96101
namedBuildTarget,
97102
target.buildTargetPlatformVal,
98-
target.HasFlag(TargetAttributes.HideInUI)));
103+
hideInUi: target.HasFlag(TargetAttributes.HideInUI),
104+
installed: BuildPipeline.GetPlaybackEngineDirectory(target.buildTargetPlatformVal, BuildOptions.None, false) != string.Empty));
99105
}
100106
}
101107

@@ -174,7 +180,8 @@ public List<BuildPlatform> GetValidPlatforms(bool includeMetaPlatforms)
174180
{
175181
List<BuildPlatform> platforms = new List<BuildPlatform>();
176182
foreach (BuildPlatform bp in buildPlatforms)
177-
if (bp.namedBuildTarget == NamedBuildTarget.Standalone || BuildPipeline.IsBuildTargetSupported(bp.namedBuildTarget.ToBuildTargetGroup(), bp.defaultTarget))
183+
if (bp.namedBuildTarget == NamedBuildTarget.Standalone ||
184+
(bp.installed && BuildPipeline.IsBuildTargetSupported(bp.namedBuildTarget.ToBuildTargetGroup(), bp.defaultTarget)))
178185
platforms.Add(bp);
179186

180187
return platforms;

Editor/Mono/BuildPipeline/DataBuildDirtyTracker.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class BuildData
4949
BuildOptions.ConnectToHost |
5050
BuildOptions.ConnectWithProfiler |
5151
BuildOptions.UncompressedAssetBundle |
52-
BuildOptions.ShaderLivelinkSupport |
5352
BuildOptions.CompressWithLz4HC;
5453
}
5554

Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected virtual string GetVariationName(BuildPostProcessArgs args)
2323
GetPlatformString(args),
2424
GetServer(args) ? "server" : "player",
2525
GetDevelopment(args) ? "development" : "nondevelopment",
26-
GetUseIl2Cpp(args) ? "il2cpp" : (GetUseCoreCLR(args) ? "coreclr" : "mono"));
26+
GetScriptingBackend(args).ToString().ToLower());
2727
}
2828

2929
protected bool GetServer(BuildPostProcessArgs args) =>

Editor/Mono/BuildPlayerWindow.cs

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -358,21 +358,19 @@ void ActiveBuildTargetsGUI()
358358
bool showRequired = requireEnabled == 0;
359359
foreach (BuildPlatform gt in BuildPlatforms.instance.buildPlatforms)
360360
{
361-
var installed = IsBuildTargetGroupInstalled(gt.namedBuildTarget.ToBuildTargetGroup(), gt.defaultTarget);
362-
363361
// All installed build targets will be shown on the first pass (showRequired = true)
364-
if (installed != showRequired)
362+
if (gt.installed != showRequired)
365363
continue;
366364

367365
// Some build targets are not publicly available, show them only when they are installed
368-
if (!installed && gt.hideInUi)
366+
if (!gt.installed && gt.hideInUi)
369367
continue;
370368

371369
// Some build targets are only compatible with specific OS
372370
if (!IsBuildTargetCompatibleWithOS(gt.defaultTarget))
373371
continue;
374372

375-
GUI.contentColor = installed ? Color.white : new Color(1, 1, 1, 0.5f);
373+
GUI.contentColor = gt.installed ? Color.white : new Color(1, 1, 1, 0.5f);
376374
ShowOption(gt, gt.title, even ? styles.evenRow : styles.oddRow);
377375
even = !even;
378376
}
@@ -537,22 +535,6 @@ void OnGUI()
537535
GUILayout.EndHorizontal();
538536
}
539537

540-
internal static bool IsBuildTargetGroupSupported(BuildTargetGroup targetGroup, BuildTarget target)
541-
{
542-
if (targetGroup == BuildTargetGroup.Standalone)
543-
return true;
544-
else
545-
return BuildPipeline.IsBuildTargetSupported(targetGroup, target);
546-
}
547-
548-
internal static bool IsBuildTargetGroupInstalled(BuildTargetGroup targetGroup, BuildTarget target)
549-
{
550-
if (targetGroup == BuildTargetGroup.Standalone)
551-
return true;
552-
else
553-
return BuildPipeline.GetPlaybackEngineDirectory(target, BuildOptions.None, false) != string.Empty;
554-
}
555-
556538
static bool IsAnyStandaloneModuleLoaded()
557539
{
558540
return ModuleManager.IsPlatformSupportLoadedByBuildTarget(BuildTarget.StandaloneLinux64) ||
@@ -656,8 +638,11 @@ static bool IsVirtualTexturingSettingsValid(BuildPlatform platform)
656638
{
657639
{ "tvOS", "AppleTV" },
658640
{ "OSXStandalone", "Mac" },
641+
{ "OSXDedicatedServer", "Mac-Server" },
659642
{ "WindowsStandalone", "Windows" },
643+
{ "WindowsDedicatedServer", "Windows-Server" },
660644
{ "LinuxStandalone", "Linux" },
645+
{ "LinuxDedicatedServer", "Linux-Server" },
661646
{ "UWP", "Universal-Windows-Platform"}
662647
};
663648
static public string GetPlaybackEngineDownloadURL(string moduleName)
@@ -742,14 +727,15 @@ static string GetUnityHubModuleDownloadURL(string moduleName)
742727
bool IsModuleNotInstalled(NamedBuildTarget namedBuildTarget, BuildTarget buildTarget)
743728
{
744729
bool licensed = BuildPipeline.LicenseCheck(buildTarget);
730+
bool installed = BuildPlatforms.instance.BuildPlatformFromNamedBuildTarget(namedBuildTarget).installed;
745731

746732
string moduleName = ModuleManager.GetTargetStringFrom(namedBuildTarget.ToBuildTargetGroup(), buildTarget);
747733

748-
return licensed &&
749-
!string.IsNullOrEmpty(moduleName) &&
734+
return !installed ||
735+
(licensed && !string.IsNullOrEmpty(moduleName) &&
750736
ModuleManager.GetBuildPostProcessor(moduleName) == null &&
751737
(BuildTargetGroup.Standalone != EditorUserBuildSettings.selectedBuildTargetGroup ||
752-
!IsAnyStandaloneModuleLoaded());
738+
!IsAnyStandaloneModuleLoaded()));
753739
}
754740

755741
static bool IsEditorInstalledWithHub()
@@ -788,6 +774,8 @@ void ShowBuildTargetSettings()
788774
GUILayout.Space(10);
789775

790776
string moduleName = ModuleManager.GetTargetStringFrom(namedBuildTarget.ToBuildTargetGroup(), buildTarget);
777+
if (namedBuildTarget == NamedBuildTarget.Server)
778+
moduleName = moduleName.Replace("Standalone", "DedicatedServer");
791779

792780
if (IsModuleNotInstalled(namedBuildTarget, buildTarget))
793781
{

Editor/Mono/EditorSceneManager.bindings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public extern static SceneAsset playModeStartScene
7878
[NativeMethod("OpenScene")]
7979
public extern static Scene OpenScene(string scenePath, [uei.DefaultValue("OpenSceneMode.Single")] OpenSceneMode mode);
8080

81-
internal static Scene OpenPreviewScene(string scenePath)
81+
public static Scene OpenPreviewScene(string scenePath)
8282
{
8383
return OpenPreviewScene(scenePath, true);
8484
}

0 commit comments

Comments
 (0)