Forum rules - please read before posting.

Reset scrollable text when changing journal page

I have a UI elements that displays the content of a document or journal page with a slider if the text is taller than the viewport. It's set up like this.
In the same UI I have buttons to flip through the pages of said document/journal. The issue is that when the player changes the page, predictably the whole text gets swapped, but the scroll doesn't reset. So if the player finished reading page 1, and has scrolled all the way down, when they flip the page they will find themselves at the bottom of page 2 instead of the top of it, which is a bit weird.
Is there a way to reset the scrollbar using AC menu "offset journal" behavior? I didn't find this discussed anywhere although I'd expect it to be a pretty common scenario

Comments

  • Open up the UI prefab, and in the "page-flip" Button's Inspector, create a new "On Click" event that points to the Scroll View, and sets the ScrollRect's verticalNormalizedPosition property to 1.

  • Thank you Chris,
    unfortunately it doesn't seem to do anything: the pages filp but the scrollbar remains at the bottom. Am I supposed to tweak the buttons settings in the AC menu panel as well?
    This is the setting for the next button
    The button inspector with the click event
    ScrollView inspector
    ScrollBar inspector

  • edited October 2023

    No, that should be it - oddly, it works on my end.

    What are your AC/Unity version numbers?

    If you create a separate Button, not linked to the Menu Manager, that does the same thing, does that work?

  • Sorry, my fault. I made the edits in a scene where I placed all my UI prefabs, but forgot to apply the overrides. everything works as intended, thanks again!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.