Announcement

Collapse
No announcement yet.

C++ Slate Scrollbox Widget Limitations & Lag

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    C++ Slate Scrollbox Widget Limitations & Lag

    Is there any definitive upper limit to the slate scrollbox? I have been able to populate it with 20,000 widgets (simple button with text and just text tested) but when I push it to say 50,000 widgets I start experiencing frame lag and delayed load time. I'm trying to create an extremely dynamic offline/online user browser system in game. I did read somewhere this could be style-related but I have yet to test that theory as I'm currently at work so I figured I'd seek some experienced advice in the meantime. Is an endless list of widgets in a scrollbox even possible? Or is it just a pipedream?

    #2
    Mind the double post..
    But I've also tried to constrain the height to no avail, it behaves as if its rendering all 50,000 widgets which are hidden by the scroll.

    Comment


      #3
      50,000 child widgets is crazy talk IMO. Even if they aren't rendered, they still have to be checked every frame for ordering and visibility calculations. That's A LOT of iteration for no real purpose.

      If you want a "limitless" list, you probably want to take a window approach where you have, let's say, 20 widgets (and only ever 20), and you simply change the data they are pointing at based on where the user is scrolling (if they are looking at entries 1 - 20, 40 - 60, etc, the widgets never change, you are just dynamically updating which data entry each widget points to). You'd need to overload the scrolling logic to move your internal data window, but that's all.
      Able Ability System - A high performance, robust ability system for UE4. Now Available!

      Comment


        #4
        I like that concept and that's pretty much what I needed to hear, I figured that would have to be the best approach. Let me then ask you this, you think I'd be able to delete each widget as it is scrolled by (Get Scroll Offset) and increase/decrease the height of a top/bottom widget to make it emulate the populated space?

        Comment


          #5
          That way I could get away with using the default scrollbox versus wasting way more time recreating it.

          Comment


            #6
            I don't think you can add/remove widgets to the scroll box and get your desired behavior since the scroll box's internal scrollbar will check to see how many widgets it has vs how many it can place on screen to determine what the max scroll limits are and which widgets are in view.

            So, instead of a scrollbox you'd just use:

            - Horizontal Box (for the layout of your entries + scrollbar)
            - Vertical Box (with all your entries contained within which use functions to pull their data based on the current scroll parameters).
            - Vertical Scrollbar (with the various scrolling min/max/view methods overriden)

            You could look at the code of the Scrollbox to give you some help on how to set everything up, but I don't think you can use it for this particular feature.
            Able Ability System - A high performance, robust ability system for UE4. Now Available!

            Comment


              #7
              So, with this method I'd also be able to rebuild the list on the fly dynamically, correct? Alphabetical order and what not? Thanks for the advice, I'll look into it for the resizing of the scrollbar dynamically and correlate it with MY list size.

              Comment


                #8
                Yea, sure. As long as you are using functions/dynamic getters rather than hard coding data - it can be organized however you wish. Again, you aren't actually changing the widgets - merely what they are showing based on whichever parameters you want.
                Able Ability System - A high performance, robust ability system for UE4. Now Available!

                Comment


                  #9
                  Hey man I just realized you were the same person I was speaking to on my current post, and not to resurrect old threads but this is very relevant. I'm attempting this now (Was without a PC for a few months) and I'm trying to figure out how to make SScrollBar actually move (Currently it's setup as you previously suggested precisely) as it will not move at all, I figured it would at least, does this have to be hard coded manually as well? Can you provide any help on how to override the scrolling logic? I'll keep tinkering otherwise. Thanks man.
                  Last edited by NachoBiznezz; 09-14-2017, 01:04 PM.

                  Comment


                    #10
                    Bump to keep relevant

                    Comment


                      #11
                      You would have to manually set/update the scrollbar via SScrollBar::SetState(...), and hook into the SScrollBar::OnUserScrolled(...).

                      SetState will set the position of the scroll and the size of the "thumbnail" (the small widget that represents the scroll position), so figure out where your scroll is on a scale of 0 - 1 and pass that in.

                      OnUserScrolled will tell you where where the widget is (again, on a scale of 0 - 1).
                      Able Ability System - A high performance, robust ability system for UE4. Now Available!

                      Comment


                        #12
                        Hey super appreciated man, I'll give this a try and update accordingly, I'm sure I'll end up hitting some road block again in the future. Those functions are EXACTLY what I was looking for, just had trouble deciphering them amongst all the others, documentation is so vague.

                        Comment


                          #13
                          Using

                          UPROPERTY(EditAnywhere, BlueprintReadWrite)
                          SScrollBar ScrollBar;

                          in the .h
                          and

                          ScrollBar = SNew(SScrollBar)

                          in the .cpp
                          failing to compile?
                          I know I'm doing something dumb here

                          "Severity Code Description Project File Line
                          Error C2679 binary '=': no operator found which takes a right-hand operand of type 'TSharedRef<ObjectType,0>' (or there is no acceptable conversion) "
                          Last edited by NachoBiznezz; 09-14-2017, 07:01 PM.

                          Comment


                            #14
                            Code:
                            TSharedRef< SScrollBar > MyScrollBar;
                            
                            MyScrollBar = SNew(SScrollBar).OnUserScrolled(this, &MyObject::OnUserScrolled);
                            You need to store the SScrollBar as a pointer, or shared ptr/ref. I'm not sure if you can expose them through the normal UPROPERTY flags.
                            Able Ability System - A high performance, robust ability system for UE4. Now Available!

                            Comment


                              #15
                              Where exactly am I supposed to pop "TSharedRef< SScrollBar > MyScrollBar;" in? Everywhere I put it results in compilation failure, also "&MyObject" = ?
                              Sorry for all the noob questions, mad appreciated.

                              Tried just about everywhere .cpp and .h
                              Last edited by NachoBiznezz; 09-14-2017, 09:09 PM.

                              Comment

                              Working...
                              X