Skip to content

Commit 705cc4c

Browse files
author
Unity Technologies
committed
Unity 2017.3.1p3 C# reference source code
1 parent 23b79f3 commit 705cc4c

7 files changed

Lines changed: 51 additions & 18 deletions

File tree

Editor/Mono/AssemblyInfo/AssemblyInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
[assembly: InternalsVisibleTo("UnityEditor.TreeEditor")]
4444
[assembly: InternalsVisibleTo("UnityEditor.Timeline")]
4545
[assembly: InternalsVisibleTo("UnityEditor.VR")]
46+
[assembly: InternalsVisibleTo("Unity.RuntimeTests")]
4647
[assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework")]
4748
[assembly: InternalsVisibleTo("UnityEditor.Facebook.Extensions")]
4849
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor-firstpass-testable")]

Editor/Mono/Inspector/ClothInspector.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -529,14 +529,15 @@ void InitBrushCollider()
529529
MeshCollider oldMeshCollider = go.GetComponent<MeshCollider>();
530530
if (oldMeshCollider != null)
531531
{
532-
if (oldMeshCollider.hideFlags == (HideFlags.HideInHierarchy | HideFlags.HideInInspector))
532+
if (((oldMeshCollider.hideFlags & HideFlags.HideInHierarchy) != 0) || ((oldMeshCollider.hideFlags & HideFlags.HideInInspector) != 0))
533533
{
534-
DestroyImmediate(oldMeshCollider);
534+
DestroyImmediate(oldMeshCollider, true);
535535
}
536536
}
537537

538538
MeshCollider meshCollider = go.AddComponent<MeshCollider>();
539-
meshCollider.hideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector;
539+
meshCollider.hideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector |
540+
HideFlags.DontSaveInEditor | HideFlags.NotEditable;
540541

541542
meshCollider.sharedMesh = m_SkinnedMeshRenderer.sharedMesh;
542543

@@ -556,9 +557,9 @@ public void OnDestroy()
556557
MeshCollider meshCollider = go.GetComponent<MeshCollider>();
557558
if (meshCollider != null)
558559
{
559-
if (meshCollider.hideFlags == (HideFlags.HideInHierarchy | HideFlags.HideInInspector))
560+
if (((meshCollider.hideFlags & HideFlags.HideInHierarchy) != 0) || ((meshCollider.hideFlags & HideFlags.HideInInspector) != 0))
560561
{
561-
DestroyImmediate(meshCollider);
562+
DestroyImmediate(meshCollider, true);
562563
}
563564
}
564565
s_BrushCreated = false;

Modules/TilemapEditor/Editor/Managed/Grid/GridBrush.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public class GridBrush : GridBrushBase
2222
[HideInInspector]
2323
private Vector3Int m_Pivot;
2424

25+
private static readonly Matrix4x4 s_Clockwise = new Matrix4x4(new Vector4(0f, 1f, 0f, 0f), new Vector4(-1f, 0f, 0f, 0f), new Vector4(0f, 0f, 1f, 0f), new Vector4(0f, 0f, 0f, 1f));
26+
private static readonly Matrix4x4 s_CounterClockwise = new Matrix4x4(new Vector4(0f, -1f, 0f, 0f), new Vector4(1f, 0f, 0f, 0f), new Vector4(0f, 0f, 1f, 0f), new Vector4(0f, 0f, 0f, 1f));
27+
2528
public Vector3Int size { get { return m_Size; } set { m_Size = value; SizeUpdated(); } }
2629
public Vector3Int pivot { get { return m_Pivot; } set { m_Pivot = value; } }
2730
public BrushCell[] cells { get { return m_Cells; } }
@@ -134,7 +137,7 @@ public override void Rotate(RotationDirection direction, Grid.CellLayout layout)
134137
int newPivotY = direction == RotationDirection.Clockwise ? pivot.x : oldSize.x - pivot.x - 1;
135138
pivot = new Vector3Int(newPivotX, newPivotY, pivot.z);
136139

137-
Matrix4x4 rotation = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0f, 0f, direction == RotationDirection.Clockwise ? 90f : -90f), Vector3.one);
140+
Matrix4x4 rotation = direction == RotationDirection.Clockwise ? s_Clockwise : s_CounterClockwise;
138141
foreach (BrushCell cell in m_Cells)
139142
{
140143
Matrix4x4 oldMatrix = cell.matrix;

Modules/UnityWebRequest/Public/WebRequestUtils.cs

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -496,27 +496,21 @@ internal static string RedirectTo(string baseUri, string redirectUri)
496496

497497
internal static string MakeInitialUrl(string targetUrl, string localUrl)
498498
{
499-
// Uri class leaves only one slash for protocol for this case, prevent that
500-
// i.e. we report streaming assets folder on Android as jar:file:///blabla, keep it that way
501-
if (targetUrl.StartsWith("jar:file://"))
502-
return targetUrl;
503-
504-
// Prevent blob url slashes from being stripped (to blob:http:/... or blob:https:/...)
505-
if (targetUrl.StartsWith("blob:http"))
506-
return targetUrl;
507-
499+
bool prependingProtocol = false;
508500
var localUri = new System.Uri(localUrl);
509501
Uri targetUri = null;
510502

511503
if (targetUrl[0] == '/')
512504
{
513505
// Prepend scheme and (if needed) host
514506
targetUri = new Uri(localUri, targetUrl);
507+
prependingProtocol = true;
515508
}
516509

517510
if (targetUri == null && domainRegex.IsMatch(targetUrl))
518511
{
519512
targetUrl = localUri.Scheme + "://" + targetUrl;
513+
prependingProtocol = true;
520514
}
521515

522516
FormatException ex = null;
@@ -538,12 +532,18 @@ internal static string MakeInitialUrl(string targetUrl, string localUrl)
538532
try
539533
{
540534
targetUri = new System.Uri(localUri, targetUrl);
535+
prependingProtocol = true;
541536
}
542537
catch (FormatException)
543538
{
544539
throw ex;
545540
}
546541

542+
return MakeUriString(targetUri, targetUrl, prependingProtocol);
543+
}
544+
545+
internal static string MakeUriString(Uri targetUri, string targetUrl, bool prependingProtocol)
546+
{
547547
// for file://protocol pass in unescaped string so we can pass it to VFS
548548
if (targetUrl.StartsWith("file://", StringComparison.OrdinalIgnoreCase))
549549
{
@@ -559,7 +559,24 @@ internal static string MakeInitialUrl(string targetUrl, string localUrl)
559559

560560
// if URL contains '%', assume it is properly escaped, otherwise '%2f' gets unescaped as '/' (which may not be correct)
561561
// otherwise escape it, i.e. replaces spaces by '%20'
562-
return targetUrl.Contains("%") ? targetUri.OriginalString : targetUri.AbsoluteUri;
562+
if (targetUrl.Contains("%"))
563+
return targetUri.OriginalString;
564+
565+
// Special handling for URIs like jar:file (Android), blob:http (WebGL and similar
566+
// Uri.AbsoluteUri class in those cases results in jar:file/path, which is incorrect because of only one slash
567+
// Uri.Scheme also returns scheme part before the colon (jar, blob)
568+
// so if we didn't prepend the scheme and scheme has colon it it, construct the URI from it's parts
569+
var scheme = targetUri.Scheme;
570+
if (!prependingProtocol && (targetUrl.Length >= scheme.Length + 2) && targetUrl[scheme.Length + 1] != '/')
571+
{
572+
StringBuilder sb = new StringBuilder(scheme, targetUrl.Length);
573+
sb.Append(':');
574+
sb.Append(targetUri.PathAndQuery); // for these spec URIs path also has the part of URI to right of colon
575+
sb.Append(targetUri.Fragment);
576+
return sb.ToString();
577+
}
578+
579+
return targetUri.AbsoluteUri;
563580
}
564581
}
565582
}

README.md

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

artifacts/generated/common/editor/PlayerSettingsXboxOneBindings.gen.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,16 @@ public extern static bool Enable7thCore
159159
set;
160160
}
161161

162+
public extern static UInt32 XTitleMemory
163+
{
164+
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
165+
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
166+
get;
167+
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
168+
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
169+
set;
170+
}
171+
162172
public extern static bool DisableKinectGpuReservation
163173
{
164174
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration

artifacts/generated/common/runtime/ApplicationBindings.gen.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,11 @@ public static bool isMobilePlatform
151151
case RuntimePlatform.IPhonePlayer:
152152
case RuntimePlatform.Android:
153153
case RuntimePlatform.TizenPlayer:
154+
return true;
154155
case RuntimePlatform.WSAPlayerX86:
155156
case RuntimePlatform.WSAPlayerX64:
156157
case RuntimePlatform.WSAPlayerARM:
157-
return true;
158+
return SystemInfo.deviceType == DeviceType.Handheld;
158159
default:
159160
return false;
160161
}

0 commit comments

Comments
 (0)