Skip to content

Commit 3da5a98

Browse files
author
Unity Technologies
committed
Unity 2018.2.12f1 C# reference source code
1 parent fe6a328 commit 3da5a98

10 files changed

Lines changed: 71 additions & 41 deletions

File tree

Editor/Mono/Animation/GameObjectRecorder.bindings.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,17 @@ public void BindComponentsOfType(GameObject target, Type componentType, bool rec
4545
extern public GameObject root { get; }
4646

4747
// Bindings.
48-
extern public void Bind(EditorCurveBinding binding);
48+
public void Bind(EditorCurveBinding binding)
49+
{
50+
if (!binding.type.IsSubclassOf(typeof(UnityEngine.Object)))
51+
throw new InvalidCastException("Binding type should derive from Unity type.");
52+
53+
BindInternal(binding);
54+
}
55+
56+
[NativeMethod("Bind")]
57+
extern private void BindInternal(EditorCurveBinding binding);
58+
4959
extern public void BindAll(GameObject target, bool recursive);
5060
extern public void BindComponent([NotNull] Component component);
5161

Editor/Mono/BuildPipeline/AssemblyStripper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,11 @@ private static string GetMethodPreserveBlacklistContents(RuntimeClassRegistry rc
314314
return sb.ToString();
315315
}
316316

317-
static public void InvokeFromBuildPlayer(BuildTarget buildTarget, RuntimeClassRegistry usedClasses)
317+
static public void InvokeFromBuildPlayer(BuildTarget buildTarget, RuntimeClassRegistry usedClasses, BuildReport report)
318318
{
319319
var stagingAreaData = Paths.Combine("Temp", "StagingArea", "Data");
320320

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

323323
var managedAssemblyFolderPath = Path.GetFullPath(Path.Combine(stagingAreaData, "Managed"));
324324
AssemblyStripper.StripAssemblies(managedAssemblyFolderPath, platformProvider, usedClasses);

Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ internal static bool UseIl2CppCodegenWithMonoBackend(BuildTargetGroup targetGrou
122122
PlayerSettings.GetScriptingBackend(targetGroup) == ScriptingImplementation.IL2CPP;
123123
}
124124

125-
internal static bool EnableIL2CPPDebugger(BuildTargetGroup targetGroup)
125+
internal static bool EnableIL2CPPDebugger(IIl2CppPlatformProvider provider, BuildTargetGroup targetGroup)
126126
{
127-
if (!EditorUserBuildSettings.allowDebugging || !EditorUserBuildSettings.development)
127+
if (!provider.allowDebugging || !provider.development)
128128
return false;
129129

130130
switch (PlayerSettings.GetApiCompatibilityLevel(targetGroup))
@@ -308,7 +308,7 @@ private void ConvertPlayerDlltoCpp(ICollection<string> userAssemblies, string ou
308308
break;
309309
}
310310

311-
if (IL2CPPUtils.EnableIL2CPPDebugger(buildTargetGroup) && platformSupportsManagedDebugging)
311+
if (IL2CPPUtils.EnableIL2CPPDebugger(m_PlatformProvider, buildTargetGroup) && platformSupportsManagedDebugging)
312312
arguments.Add("--enable-debugger");
313313

314314
var il2CppNativeCodeBuilder = m_PlatformProvider.CreateIl2CppNativeCodeBuilder();
@@ -438,6 +438,8 @@ internal interface IIl2CppPlatformProvider
438438
string moduleStrippingInformationFolder { get; }
439439
bool supportsEngineStripping { get; }
440440
bool supportsManagedDebugging { get; }
441+
bool development { get; }
442+
bool allowDebugging { get; }
441443

442444
BuildReport buildReport { get; }
443445
string[] includePaths { get; }
@@ -450,10 +452,11 @@ internal interface IIl2CppPlatformProvider
450452

451453
internal class BaseIl2CppPlatformProvider : IIl2CppPlatformProvider
452454
{
453-
public BaseIl2CppPlatformProvider(BuildTarget target, string libraryFolder)
455+
public BaseIl2CppPlatformProvider(BuildTarget target, string libraryFolder, BuildReport buildReport)
454456
{
455457
this.target = target;
456458
this.libraryFolder = libraryFolder;
459+
this.buildReport = buildReport;
457460
}
458461

459462
public virtual BuildTarget target { get; private set; }
@@ -491,9 +494,30 @@ public virtual bool supportsManagedDebugging
491494
get { return false; }
492495
}
493496

494-
public virtual BuildReport buildReport
497+
498+
public virtual bool development
495499
{
496-
get { return null; }
500+
get
501+
{
502+
if (buildReport != null)
503+
return (buildReport.summary.options & BuildOptions.Development) == BuildOptions.Development;
504+
return false;
505+
}
506+
}
507+
508+
public virtual bool allowDebugging
509+
{
510+
get
511+
{
512+
if (buildReport != null)
513+
return (buildReport.summary.options & BuildOptions.AllowDebugging) == BuildOptions.AllowDebugging;
514+
return false;
515+
}
516+
}
517+
518+
public BuildReport buildReport
519+
{
520+
get; private set;
497521
}
498522

499523
public virtual string[] includePaths

Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ static class Styles
134134
public static readonly GUIContent appleDeveloperTeamID = EditorGUIUtility.TrTextContent("iOS Developer Team ID", "Developers can retrieve their Team ID by visiting the Apple Developer site under Account > Membership.");
135135
public static readonly GUIContent useOnDemandResources = EditorGUIUtility.TrTextContent("Use on demand resources*");
136136
public static readonly GUIContent accelerometerFrequency = EditorGUIUtility.TrTextContent("Accelerometer Frequency*");
137-
public static readonly GUIContent cameraUsageDescription = EditorGUIUtility.TrTextContent("Camera Usage Description*");
138-
public static readonly GUIContent locationUsageDescription = EditorGUIUtility.TrTextContent("Location Usage Description*");
139-
public static readonly GUIContent microphoneUsageDescription = EditorGUIUtility.TrTextContent("Microphone Usage Description*");
137+
public static readonly GUIContent cameraUsageDescription = EditorGUIUtility.TrTextContent("Camera Usage Description*", "String shown to the user when requesting permission to use the device camera. Written to the NSCameraUsageDescription field in Xcode project's info.plist file");
138+
public static readonly GUIContent locationUsageDescription = EditorGUIUtility.TrTextContent("Location Usage Description*", "String shown to the user when requesting permission to access the device location. Written to the NSLocationWhenInUseUsageDescription field in Xcode project's info.plist file.");
139+
public static readonly GUIContent microphoneUsageDescription = EditorGUIUtility.TrTextContent("Microphone Usage Description*", "String shown to the user when requesting to use the device microphone. Written to the NSMicrophoneUsageDescription field in Xcode project's info.plist file");
140140
public static readonly GUIContent muteOtherAudioSources = EditorGUIUtility.TrTextContent("Mute Other Audio Sources*");
141141
public static readonly GUIContent prepareIOSForRecording = EditorGUIUtility.TrTextContent("Prepare iOS for Recording");
142142
public static readonly GUIContent forceIOSSpeakersWhenRecording = EditorGUIUtility.TrTextContent("Force iOS Speakers when Recording");

Editor/Src/VR/Mono/PlayerSettingsEditorVR.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -563,18 +563,6 @@ internal void TangoGUI(BuildTargetGroup targetGroup)
563563

564564
// Google Tango settings
565565
EditorGUILayout.PropertyField(m_AndroidEnableTango, EditorGUIUtility.TrTextContent("ARCore Supported"));
566-
567-
if (PlayerSettings.Android.ARCoreEnabled)
568-
{
569-
EditorGUI.indentLevel++;
570-
571-
if ((int)PlayerSettings.Android.minSdkVersion < 24)
572-
{
573-
GUIContent tangoAndroidWarning = EditorGUIUtility.TrTextContent("ARCore requires 'Minimum API Level' to be at least Android 7.0");
574-
EditorGUILayout.HelpBox(tangoAndroidWarning.text, MessageType.Warning);
575-
}
576-
EditorGUI.indentLevel--;
577-
}
578566
}
579567

580568
internal void VuforiaGUI(BuildTargetGroup targetGroup)

Modules/TextRendering/TextRendering.bindings.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,14 @@ public static int GetMaxVertsForString(string str)
365365
}
366366

367367
internal static extern Font GetDefault();
368-
public extern bool HasCharacter(char c);
368+
369+
public bool HasCharacter(char c)
370+
{
371+
return HasCharacter((int)c);
372+
}
373+
374+
private extern bool HasCharacter(int c);
375+
369376
public static extern string[] GetOSInstalledFontNames();
370377

371378
private static extern void Internal_CreateFont([Writable] Font self, string name);

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Unity 2018.2.11f1 C# reference source code
1+
## Unity 2018.2.12f1 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.

Runtime/AR/Tango/ScriptBindings/Tango.bindings.cs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,17 @@ internal struct CoordinateFramePair
5050

5151
[UsedByNativeCode]
5252
[NativeHeader("ARScriptingClasses.h")]
53-
[StructLayout(LayoutKind.Explicit, Size = 92)]
53+
[StructLayout(LayoutKind.Explicit, Size = 60)]
5454
internal struct PoseData
5555
{
56-
[FieldOffset(0)] public uint version;
57-
[FieldOffset(8)] public double timestamp;
58-
[FieldOffset(16)] public double orientation_x;
59-
[FieldOffset(24)] public double orientation_y;
60-
[FieldOffset(32)] public double orientation_z;
61-
[FieldOffset(40)] public double orientation_w;
62-
[FieldOffset(48)] public double translation_x;
63-
[FieldOffset(56)] public double translation_y;
64-
[FieldOffset(64)] public double translation_z;
65-
[FieldOffset(72)] public PoseStatus statusCode;
66-
[FieldOffset(76)] public CoordinateFramePair frame;
67-
[FieldOffset(84)] public uint confidence;
68-
[FieldOffset(88)] public float accuracy;
56+
[FieldOffset(0)] public double orientation_x;
57+
[FieldOffset(8)] public double orientation_y;
58+
[FieldOffset(16)] public double orientation_z;
59+
[FieldOffset(24)] public double orientation_w;
60+
[FieldOffset(32)] public double translation_x;
61+
[FieldOffset(40)] public double translation_y;
62+
[FieldOffset(48)] public double translation_z;
63+
[FieldOffset(56)] public PoseStatus statusCode;
6964

7065
public Quaternion rotation
7166
{

Runtime/Export/iOS/iOSDevice.bindings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ public enum DeviceGeneration
5151
iPhone8 = 37,
5252
iPhone8Plus = 38,
5353
iPhoneX = 39,
54+
iPhoneXS = 40,
55+
iPhoneXSMax = 41,
56+
iPhoneXR = 42,
5457

5558
iPhoneUnknown = 10001,
5659
iPadUnknown = 10002,

Runtime/Transform/ScriptBindings/Transform.bindings.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,10 @@ public int hierarchyCapacity
382382
[FreeFunction("SetHierarchyCapacity", HasExplicitThis = true)]
383383
private extern void internal_setHierarchyCapacity(int value);
384384

385-
public int hierarchyCount { get; }
385+
public int hierarchyCount { get { return internal_getHierarchyCount(); } }
386+
387+
[FreeFunction("GetHierarchyCount", HasExplicitThis = true)]
388+
private extern int internal_getHierarchyCount();
386389

387390
[NativeConditional("UNITY_EDITOR")]
388391
[FreeFunction("IsNonUniformScaleTransform", HasExplicitThis = true)]

0 commit comments

Comments
 (0)