zawe
New Member
Posts: 6
|
Post by zawe on Jun 6, 2023 13:59:23 GMT
Hi there, during runtime the GameObject which has EnhancedScroller component gets a child - GameObject called Container. This Container has component of type Horizontal/Vertical group. Is it possible to align Container in the middle of it's parent? It seems that left alignment is always set ad default 👇
|
|
|
Post by echo17 on Jun 8, 2023 8:31:00 GMT
Take a look at the EnhancedScroller.cs script, specifically in the Awake method (line 1869 in the latest release). You'll see a section that sets the container's anchor, pivot, position, scale, and offset.
// set the containers anchor and pivot if (scrollDirection == ScrollDirectionEnum.Vertical) { _container.anchorMin = new Vector2(0, 1); _container.anchorMax = Vector2.one; _container.pivot = new Vector2(0.5f, 1f); } else { _container.anchorMin = Vector2.zero; _container.anchorMax = new Vector2(0, 1f); _container.pivot = new Vector2(0, 0.5f); } _container.localPosition = Vector3.zero; _container.localRotation = Quaternion.identity; _container.localScale = Vector3.one; _container.offsetMax = Vector2.zero; _container.offsetMin = Vector2.zero;
I don't know what changing these will do as far as usability of the scroller. I tried to make it as universal as possible, so I followed Unity's examples for setting up the scroll view. I'm sure experimenting with these lines of code will get you to where you want to be.
|
|