- Home /
ScrollRect.verticalNormalizedPosition disables scrolling capability.
I have text that auto-types within a textbox. I have attached a Scroll Rect component and can successfully scroll throughout the text with my mouse.
Since the text appears auto-typed, I wished for the text to auto scroll down when it exceeded the text box. I implemented this successfully using 'verticalNormalizedPosition'. However, once 'verticalNormalizedPosition' is called, the scrolling feature is disabled.
On the GameObject that contains my text, it seems that 'verticalNormalizedPosition' disables the 'Pos Y' of the Rect Transform, thus making my vertical scroll inoperative.
Is there something I can do to prevent this from happening - is it possible to enable the Y position? Thanks.
Answer by Ashokkumar-M · Jul 10, 2017 at 06:14 AM
ScrollRect.verticalNormalizedPosition sets the scroll position from 1 to 0 as start to end respectively.
You are setting the verticalNormalizedPosition in update or whenever you are adding a char in the textbox. So you trying to repositioning the scroll in code each time. So when you try to scroll it in unity editor it is getting positioned to the end.
So in your case, you have to stop setting the verticalNormalizedPosition while dragging the scroll. You can do it by adding Event Trigger component to the scroll and on Begin Drag , End Drag events can be triggered to set a bool variable in the code based on the drag to set verticalNormalizedPosition. @Darius0995
This is exactly the logic that I required. $$anonymous$$uch appreciated. :D
Your answer
Follow this Question
Related Questions
Focus on Selected Item in Vertical Scrollview 0 Answers
Pass through control on UI elements? 0 Answers
vertical scrolling, non editable text area. 1 Answer
Scrollable Text of Arbitrary Length 0 Answers