void SetLayout(int axis) { if (axis == 0 && CurrentSettings.HorizontalFit == FitMode.Unconstrained) { return; } if (axis == 1 && CurrentSettings.VerticalFit == FitMode.Unconstrained) { return; } if (isAnimating) { return; } if (CurrentSettings.IsAnimated) { start.PullFromTransform(this.transform as RectTransform); } if (axis == 0) { base.SetLayoutHorizontal(); } else { base.SetLayoutVertical(); } ApplyOffsetToDefaultSize(axis, (axis == 0) ? m_HorizontalFit : m_VerticalFit); if (CurrentSettings.IsAnimated) { end.PullFromTransform(this.transform as RectTransform); start.PushToTransform(this.transform as RectTransform); Animate(); } }
public void OnValidate() { bool isUnInitialized = transformConfigs == null || (transformConfigs.Items.Count == 0 && transformFallback.Scale == Vector3.zero && transformFallback.Rotation.eulerAngles == Vector3.zero && transformFallback.AnchoredPosition == Vector2.zero && transformFallback.AnchorMin == Vector2.zero && transformFallback.AnchorMax == Vector2.zero && transformFallback.Pivot == Vector2.zero && transformFallback.SizeDelta == Vector2.zero && transformFallback.LocalPosition == Vector3.zero); if (isUnInitialized) { if (transformFallback == null) { transformFallback = new RectTransformData(); } transformFallback.PullFromTransform(rectTransform); } }