6 [RequireComponent(typeof(ScrollRect))]
7 [AddComponentMenu(
"UI/Extensions/ScrollRectLinker")]
14 ScrollRect controllingScrollRect =
null;
15 ScrollRect scrollRect =
null;
19 scrollRect = GetComponent<ScrollRect>();
20 if (controllingScrollRect !=
null)
21 controllingScrollRect.onValueChanged.AddListener(MirrorPos);
24 void MirrorPos(Vector2 scrollPos)
28 scrollRect.normalizedPosition =
new Vector2(Mathf.Clamp01(scrollPos.x), Mathf.Clamp01(scrollPos.y));
30 scrollRect.normalizedPosition = scrollPos;
Credit Erdener Gonenc - @PixelEnvision.