Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Question ScrollView value changed callback

Discussion in 'UI Toolkit' started by Hellfim, May 27, 2023.

  1. Hellfim

    Hellfim

    Joined:
    Sep 11, 2014
    Posts:
    127
    Is there any way to handle scrollOffset's changes of the ScrollView?
    Would be REALLY good to have support for ChangeEvent<Vector2> (for example by having ScrollView implement INotifyValueChanged<Vector2>)

    I mean I can check wether scrollOffset did change if I use scheduler.Execute(ProcessScrollOffset).Until(() => false), but that seems like a bad practice.


    I would also like to mention here that PostPointerUpAnimation executes at static 30ms which produces jittery behaviour.
     
    StripeGuy likes this.
  2. griendeau_unity

    griendeau_unity

    Unity Technologies

    Joined:
    Aug 25, 2020
    Posts:
    248
    You can register value changes on the ScrollView's Scrollers instead.

    scrollView.horizontalScroller.slider.RegisterValueChangedCallback(...);

    scrollView.verticalScroller.slider.RegisterValueChangedCallback(...);


    I agree it would be nice to have a callback on the ScrollView directly. You can report a bug using `Help -> Report a Bug...` to get it in our pipeline. Same for the PostPointerUpAnimation animation interval.
     
    Last edited: May 31, 2023
    Hellfim likes this.
  3. Hellfim

    Hellfim

    Joined:
    Sep 11, 2014
    Posts:
    127
    Whoah, nice. Somewhy I though that if I have disabled scrollers they don't produce events, my bad.

    Great to hear that! Please, check IN-42607

    Actually I already did this, but recieved a comment 'not enough information to reproduce'
    Please, check IN-42122 for that. I'm not sure what else should I do, hope you will be able to review that case and forward it to your internal pipeline.
     
    StripeGuy and griendeau_unity like this.