Skip to content

Commit

Permalink
fix issue qiankanglai#168: leave assert in Awake but move initializ…
Browse files Browse the repository at this point in the history
…ation into ctor
  • Loading branch information
qiankanglai committed Mar 3, 2024
1 parent b637aca commit 22ee7b6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Runtime/LoopHorizontalScrollRect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ namespace UnityEngine.UI
[DisallowMultipleComponent]
public class LoopHorizontalScrollRect : LoopScrollRect
{
LoopHorizontalScrollRect()
{
direction = LoopScrollRectDirection.Horizontal;
}

protected override float GetSize(RectTransform item, bool includeSpacing)
{
float size = includeSpacing ? contentSpacing : 0;
Expand Down Expand Up @@ -39,7 +44,6 @@ protected override Vector2 GetVector(float value)

protected override void Awake()
{
direction = LoopScrollRectDirection.Horizontal;
base.Awake();
if (m_Content)
{
Expand Down
6 changes: 5 additions & 1 deletion Runtime/LoopHorizontalScrollRectMulti.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ namespace UnityEngine.UI
[DisallowMultipleComponent]
public class LoopHorizontalScrollRectMulti : LoopScrollRectMulti
{
LoopHorizontalScrollRectMulti()
{
direction = LoopScrollRectDirection.Horizontal;
}

protected override float GetSize(RectTransform item, bool includeSpacing)
{
float size = includeSpacing ? contentSpacing : 0;
Expand Down Expand Up @@ -39,7 +44,6 @@ protected override Vector2 GetVector(float value)

protected override void Awake()
{
direction = LoopScrollRectDirection.Horizontal;
base.Awake();
if (m_Content)
{
Expand Down
6 changes: 5 additions & 1 deletion Runtime/LoopVerticalScrollRect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ namespace UnityEngine.UI
[DisallowMultipleComponent]
public class LoopVerticalScrollRect : LoopScrollRect
{
LoopVerticalScrollRect()
{
direction = LoopScrollRectDirection.Vertical;
}

protected override float GetSize(RectTransform item, bool includeSpacing)
{
float size = includeSpacing ? contentSpacing : 0;
Expand Down Expand Up @@ -40,7 +45,6 @@ protected override Vector2 GetVector(float value)

protected override void Awake()
{
direction = LoopScrollRectDirection.Vertical;
base.Awake();
if (m_Content)
{
Expand Down
5 changes: 4 additions & 1 deletion Runtime/LoopVerticalScrollRectMulti.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ namespace UnityEngine.UI
[DisallowMultipleComponent]
public class LoopVerticalScrollRectMulti : LoopScrollRectMulti
{
LoopVerticalScrollRectMulti()
{
direction = LoopScrollRectDirection.Vertical;
}
protected override float GetSize(RectTransform item, bool includeSpacing)
{
float size = includeSpacing ? contentSpacing : 0;
Expand Down Expand Up @@ -40,7 +44,6 @@ protected override Vector2 GetVector(float value)

protected override void Awake()
{
direction = LoopScrollRectDirection.Vertical;
base.Awake();
if (m_Content)
{
Expand Down

0 comments on commit 22ee7b6

Please sign in to comment.