Skip to content

Commit 67c4513

Browse files
author
Philip Cosgrave
committed
Commit of ui system for 2017.3f2. Also removing bad reference to a original file added in 5.6 commit.
1 parent 9474223 commit 67c4513

28 files changed

Lines changed: 42 additions & 35 deletions

UnityEngine.UI-Editor/UnityEngine.UI-Editor.csproj

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@
8282
<!--Uncomment the block below and change the destination to copy the built dll into your unity install directory-->
8383
<!--<Copy SourceFiles="$(TargetDir)$(TargetName).dll" DestinationFiles="C:\Program Files (x86)\Unity\Editor\Data\UnityExtensions\Unity\GUISystem\4.6.0\$(TargetName).dll"/>-->
8484
</Target>
85-
<ItemGroup>
86-
<None Include="..\UnityEngine.UI\UI\Core\GraphicRaycaster.cs.orig">
87-
<Link>UI\Core\GraphicRaycaster.cs.orig</Link>
88-
</None>
89-
</ItemGroup>
9085
<ItemGroup>
9186
<Compile Include="..\UnityEngine.UI\EventSystem\EventData\AxisEventData.cs">
9287
<Link>EventSystem\EventData\AxisEventData.cs</Link>
@@ -126,8 +121,6 @@
126121
</Compile>
127122
<Compile Include="..\UnityEngine.UI\EventSystem\InputModules\BaseInput.cs">
128123
<Link>EventSystem\InputModules\BaseInput.cs</Link>
129-
<SubType>
130-
</SubType>
131124
</Compile>
132125
<Compile Include="..\UnityEngine.UI\EventSystem\InputModules\BaseInputModule.cs">
133126
<Link>EventSystem\InputModules\BaseInputModule.cs</Link>

UnityEngine.UI/UI/Core/GraphicRaycaster.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ private static void Raycast(Canvas canvas, Camera eventCamera, Vector2 pointerPo
268268
if (!RectTransformUtility.RectangleContainsScreenPoint(graphic.rectTransform, pointerPosition, eventCamera))
269269
continue;
270270

271+
if (eventCamera != null && eventCamera.WorldToScreenPoint(graphic.rectTransform.position).z > eventCamera.farClipPlane)
272+
continue;
273+
271274
if (graphic.Raycast(pointerPosition, eventCamera))
272275
{
273276
s_SortedGraphics.Add(graphic);

UnityEngine.UI/UI/Core/Image.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,14 @@ public override Material material
189189
{
190190
if (m_Material != null)
191191
return m_Material;
192+
#if UNITY_EDITOR
193+
if (Application.isPlaying && activeSprite && activeSprite.associatedAlphaSplitTexture != null)
194+
return defaultETC1GraphicMaterial;
195+
#else
192196

193197
if (activeSprite && activeSprite.associatedAlphaSplitTexture != null)
194198
return defaultETC1GraphicMaterial;
199+
#endif
195200

196201
return defaultMaterial;
197202
}

UnityEngine.UI/UI/Core/Layout/AspectRatioFitter.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Collections;
12
using UnityEngine.EventSystems;
23

34
namespace UnityEngine.UI
@@ -36,12 +37,12 @@ protected AspectRatioFitter() {}
3637
protected override void OnEnable()
3738
{
3839
base.OnEnable();
39-
SetDirty();
40+
SetDirty(true);
4041
}
4142

4243
protected override void OnDisable()
4344
{
44-
m_Tracker.Clear(true);
45+
m_Tracker.Clear();
4546
LayoutRebuilder.MarkLayoutForRebuild(rectTransform);
4647
base.OnDisable();
4748
}
@@ -56,7 +57,7 @@ private void UpdateRect()
5657
if (!IsActive())
5758
return;
5859

59-
m_Tracker.Clear(false);
60+
m_Tracker.Clear();
6061

6162
switch (m_AspectMode)
6263
{
@@ -128,11 +129,20 @@ public virtual void SetLayoutHorizontal() {}
128129

129130
public virtual void SetLayoutVertical() {}
130131

131-
protected void SetDirty()
132+
private IEnumerator DelayUpdate()
132133
{
134+
yield return null;
133135
UpdateRect();
134136
}
135137

138+
protected void SetDirty(bool delayUpdate = false)
139+
{
140+
if (delayUpdate)
141+
StartCoroutine(DelayUpdate());
142+
else
143+
UpdateRect();
144+
}
145+
136146
#if UNITY_EDITOR
137147
protected override void OnValidate()
138148
{

UnityEngine.UI/UI/Core/Layout/ContentSizeFitter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected override void OnEnable()
4444

4545
protected override void OnDisable()
4646
{
47-
m_Tracker.Clear(true);
47+
m_Tracker.Clear();
4848
LayoutRebuilder.MarkLayoutForRebuild(rectTransform);
4949
base.OnDisable();
5050
}
@@ -75,7 +75,7 @@ private void HandleSelfFittingAlongAxis(int axis)
7575

7676
public virtual void SetLayoutHorizontal()
7777
{
78-
m_Tracker.Clear(true);
78+
m_Tracker.Clear();
7979
HandleSelfFittingAlongAxis(0);
8080
}
8181

UnityEngine.UI/UI/Core/Layout/LayoutGroup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public virtual void CalculateLayoutInputHorizontal()
6666
}
6767
}
6868
ListPool<Component>.Release(toIgnoreList);
69-
m_Tracker.Clear(true);
69+
m_Tracker.Clear();
7070
}
7171

7272
public abstract void CalculateLayoutInputVertical();
@@ -99,7 +99,7 @@ protected override void OnEnable()
9999

100100
protected override void OnDisable()
101101
{
102-
m_Tracker.Clear(true);
102+
m_Tracker.Clear();
103103
LayoutRebuilder.MarkLayoutForRebuild(rectTransform);
104104
base.OnDisable();
105105
}

UnityEngine.UI/UI/Core/ScrollRect.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ protected override void OnDisable()
241241
m_VerticalScrollbar.onValueChanged.RemoveListener(SetVerticalNormalizedPosition);
242242

243243
m_HasRebuiltLayout = false;
244-
m_Tracker.Clear(true);
244+
m_Tracker.Clear();
245245
m_Velocity = Vector2.zero;
246246
LayoutRebuilder.MarkLayoutForRebuild(rectTransform);
247247
base.OnDisable();
@@ -379,7 +379,6 @@ protected virtual void LateUpdate()
379379
return;
380380

381381
EnsureLayoutHasRebuilt();
382-
UpdateScrollbarVisibility();
383382
UpdateBounds();
384383
float deltaTime = Time.unscaledDeltaTime;
385384
Vector2 offset = CalculateOffset(Vector2.zero);
@@ -412,16 +411,13 @@ protected virtual void LateUpdate()
412411
}
413412
}
414413

415-
if (m_Velocity != Vector2.zero)
414+
if (m_MovementType == MovementType.Clamped)
416415
{
417-
if (m_MovementType == MovementType.Clamped)
418-
{
419-
offset = CalculateOffset(position - m_Content.anchoredPosition);
420-
position += offset;
421-
}
422-
423-
SetContentAnchoredPosition(position);
416+
offset = CalculateOffset(position - m_Content.anchoredPosition);
417+
position += offset;
424418
}
419+
420+
SetContentAnchoredPosition(position);
425421
}
426422

427423
if (m_Dragging && m_Inertia)
@@ -437,6 +433,7 @@ protected virtual void LateUpdate()
437433
m_OnValueChanged.Invoke(normalizedPosition);
438434
UpdatePrevData();
439435
}
436+
UpdateScrollbarVisibility();
440437
}
441438

442439
protected void UpdatePrevData()
@@ -584,7 +581,7 @@ public virtual void CalculateLayoutInputVertical() {}
584581

585582
public virtual void SetLayoutHorizontal()
586583
{
587-
m_Tracker.Clear(true);
584+
m_Tracker.Clear();
588585

589586
if (m_HSliderExpand || m_VSliderExpand)
590587
{

UnityEngine.UI/UI/Core/Scrollbar.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ protected override void OnEnable()
132132

133133
protected override void OnDisable()
134134
{
135-
m_Tracker.Clear(true);
135+
m_Tracker.Clear();
136136
base.OnDisable();
137137
}
138138

@@ -195,7 +195,7 @@ private void UpdateVisuals()
195195
if (!Application.isPlaying)
196196
UpdateCachedReferences();
197197
#endif
198-
m_Tracker.Clear(true);
198+
m_Tracker.Clear();
199199

200200
if (m_ContainerRect != null)
201201
{

UnityEngine.UI/UI/Core/Slider.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected override void OnEnable()
153153

154154
protected override void OnDisable()
155155
{
156-
m_Tracker.Clear(true);
156+
m_Tracker.Clear();
157157
base.OnDisable();
158158
}
159159

@@ -184,7 +184,7 @@ protected override void OnDidApplyAnimationProperties()
184184

185185
void UpdateCachedReferences()
186186
{
187-
if (m_FillRect)
187+
if (m_FillRect && m_FillRect != (RectTransform)transform)
188188
{
189189
m_FillTransform = m_FillRect.transform;
190190
m_FillImage = m_FillRect.GetComponent<Image>();
@@ -193,18 +193,20 @@ void UpdateCachedReferences()
193193
}
194194
else
195195
{
196+
m_FillRect = null;
196197
m_FillContainerRect = null;
197198
m_FillImage = null;
198199
}
199200

200-
if (m_HandleRect)
201+
if (m_HandleRect && m_HandleRect != (RectTransform)transform)
201202
{
202203
m_HandleTransform = m_HandleRect.transform;
203204
if (m_HandleTransform.parent != null)
204205
m_HandleContainerRect = m_HandleTransform.parent.GetComponent<RectTransform>();
205206
}
206207
else
207208
{
209+
m_HandleRect = null;
208210
m_HandleContainerRect = null;
209211
}
210212
}
@@ -269,7 +271,7 @@ private void UpdateVisuals()
269271
UpdateCachedReferences();
270272
#endif
271273

272-
m_Tracker.Clear(true);
274+
m_Tracker.Clear();
273275

274276
if (m_FillContainerRect != null)
275277
{

UnityEngine.UI/UnityEngine.UI.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,6 @@
317317
<SubType>Code</SubType>
318318
</Compile>
319319
</ItemGroup>
320-
<ItemGroup>
321-
<None Include="UI\Core\GraphicRaycaster.cs.orig" />
322-
</ItemGroup>
323320
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
324321
<PropertyGroup>
325322
</PropertyGroup>

0 commit comments

Comments
 (0)