Search Unity

Optimized ScrollView Adapter + Playmaker support

Discussion in 'Assets and Asset Store' started by xucian, Apr 1, 2016.

  1. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    SRIA v4.0 is (a)live! :D
     
  2. helloworldgames

    helloworldgames

    Joined:
    Mar 16, 2017
    Posts:
    60
    Can you please add support for pull up to load more items? you already have pull down to refresh but couldnt see pull up to load more in your demos. im looking for a highly supported (ur seems very supportive) plugin which supports this
    thanks
     
  3. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Sure, I've already submitted a version with this change now. Should be live in a few days. It's pretty easy to re-use the existing functionality. Let me know via email if you need this sooner and I'll give you an early access version

    Lucian
     
    helloworldgames likes this.
  4. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Important notice - 27.07.2018:
    v4.1 is stable and available (see the changelog above), but it'll take a few days to a week until it'll go live.
    We recommend new users to use this version.
    You can request it through email. Please also provide the invoice number, if you didn't already

    :)
     
    Last edited: Jul 28, 2018
  5. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,941
    @thefallengamesstudio
    does this have a responsive grid view with pull down and pull up included in single demo? Thanks
     
  6. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Hey,

    In v4.0 there's only pull down, but v4.1 was just submitted and it includes pull up + pull down.
    We can provide this package as an early access one if you send us an email with the invoice number.

    Now, speaking only of v4.1, there's a demo for pull down+up and a few others for grids.
    We keep them separated for obvious reasons, but you can extract functionality from any number of demos and use them in the same ScrollView.
    In your case, the pull up/down script is independent of the scrollview's format, so you'll have no problem combining them
     
  7. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    v4.1 is (a)live! :D
    Users that upgrade from previous versions, please do a backup first and read the changelog
     
  8. ghassan_unity602

    ghassan_unity602

    Joined:
    Aug 13, 2018
    Posts:
    2
    Hello, thanks a lot for your great Library. But I noticed that Pull To Refresh doesn't work when you have few items (or fewer than the Content Size), even in your example, it doesn't work when the Item count is <5 or something. Is there a work around for it?
     
  9. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Hey.
    Hey, thanks for noticing this. For some reason, the v4.1 android APK didn't finish uploading at the moment of launch. I've uploaded it now. You can access it from the same link.
    Do you say that that feature also doesn't work in unity editor?

    Lucian
     
  10. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,941
    @thefallengamesstudio
    Just bought your plugin, will b testing it in detail

    I dont see any example with list item select event, so we know which item was selected, so if a new item is selected then old item becomes unselected

    i also have a request to make for future version, which is ability to provide slide right left to show hidden options like this
    https://ionicframework.com/docs/api/components/item/ItemSliding/

    Thanks
     
    Last edited: Aug 13, 2018
  11. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Hi,

    As I understand it,you want a feature where you can only have 0 or 1 items selected at once, so you can do some action on it. Since this is a very particular case, but also quite easy to implement using simple button click events to manage what item is selected at any given time, it won't be implemented as a whole demo scene. If you'll need help with this, please describe the desired behavior in more detail and I'll be happy to help.

    As for the suggestion, that's a nice thing to have. I put it into the to-do list as a new demo scene. Thanks

    Lucian
     
  12. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    Hi,
    I bought this asset today, and I get one remark and 2 problems
    Remark :
    -In my first test, I try to use a simple text as prefab. It not worked (I understand after reading the doc ;) But A message should be welcome :p

    Problems :
    -You use a RectMask2D on the Views GameObject, ans so for each cell objects created at runtime. It creates a performance problem. The RectMask2D avoid Unity to batch the canvas draws. In the grid_plus_horizontal_plus_async_download sample, the Frame Debug indicates 55 draws. A draw is call for each object (each image, each text...). If I remove the RectMask2D, I have "only" 44 draws, because all the texts are drawn with a single Draw mesh. With an atlas, all the images should be drawn in one call ;).
    For performance, you have to reduce the draw calls ! I spent a lot of time to reduce it in my project
    I have deactivated the RectMask2D component on the cell prefab, and the clipping continues to work fine. Is it really necessary to have it ?? The viewport RectMask2D is enough for the global clipping. Why do you add one on the cell prefab ?
    I suggest you to remove the RectMask2D on the cell prefab everywhere in the demos and the wizard, it's a bad idea to suggest to use it for the Unity newbies ;)

    -The cell prefab have to get a Views object. The cell prefab can't be the Views object itself (I get an exception with this message, if I return the cell prefab in the GetViews method). Why this limitation ? I try to delete all
    the unnecessaries GameObject, because a unnecessary gameObject it's an unnecessary amount of used memory ;)
    I see that in the simple tutorial, there is no Views object. When the Views is required and why ?

    Some Guys have written in the reviews that the asset has a bad quality of code, I dont see that
    But the MVC pattern is a little complicated for beginners (especially if they never use a data binding)

    Thanks
     
  13. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    Hi,
    When I create a new Grid with the wizard, the Viewport has a Mask component, not a RectMask2D component. Generally, you use RectMask2D everywhere, why not use the RectMask2D in this case ? A RectMask2D should be used for better performance

    Your component create a frame8 menu, with a OSA submenu. Your menu frame8 is not in Unity spirit and shouldn't be exist, the OSA submenu, should be moved in Window menu. All my asset are done like this ;)
    If each asset creates its own main menu, my Window menu won't be visible :p

    Thanks
     
    Last edited: Aug 16, 2018
  14. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    After some testing, I see that the Mask component is really necessary in one case, and should be set to the GridLayout itself : when I use a Raw Image with a material Shader. I don't find another solution than the Mask on the GridLayout
    The mask on the viewport has no effect
    Moreover, I always delete the image background of the layout (image stored on the main window), but in this case the Mask stops to work on the Image with a shader :(
     
  15. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Hey,

    Sorry for the late reply. I took a 1-week break from work. Will be back in the office at full speed starting with Monday.

    Thanks for observing the unnecessarry RM2Ds. They were sometimes required by the old grid layouting system which forced the cells to be stretched, but we can safely remove them now, of course.
    This worked together with the 'Views' child. I'll make sure to do the necessary changes to get rid of them.
    Will put it first on the to-do list. Thanks!

    Also noted this. I forgot to change the wizard's basic templates when all Masks were replaced with RectMask2D. We had a lot of problems with RectMask2D on several unity versions (2017.x IIRC), so we might've hesitated to do a complete replacement, especially because the Mask component works in all cases for us. We'll see if giving a note inside the scene\code about switching to RM2D or having it added by default is better, given the inconsistencies we've found on different Unity versions.

    That's a valid concern, about the frame8 menu. frame8 is our internal library that includes everything we do. We thought about the possibility of renaming it to TFG, so it'll represent the company name. This menu would contain a sub-menu for any of our assets, so you'll have it all in one place. We'll seriously think about moving it under the Window menu, as per your suggestion. Thanks!

    Do you mean the Unity's built-in GridLayout?
     
  16. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    Hi,

    The answers can wait monday, enjoy your holidays ;)

    No your component :p
    but It's the same problem with the built-in GridLayout. It seems to be a Mask component limitation
    It's just a remark/information about the mask, even with it, sometimes somes image can't be clipped.
    And it depends on the image component

    I read a part of your code, and I think that some modifications could help to read it
    -not always " MS c# namaing guideline" compliant : private word should be added and explicit (field, properties, methods), don't use prefix _ (I also see the worst : "bool _;")
    -correct the warnings (15), you should never have it in a final release
    -avoid the notation "var v in subItems", use "var item in subItems" (item or subItem of course)
    -use clear naming, avoid thing like "float t01;", vh, nlvRT...
    -always use the same good naming. In LabelWithToggles class, I see "foreach (var subItem in subItems)" and "foreach (var v in subItems)". use only the first
    -In GridAdapter you have "base.ItemsRefreshed += OnCellGroupsRefreshed;", never use a event in the same class, events should be used between different classes, use a correct and direct inheritance (Microsoft events design). In your case a event calls a method that call an event !!
    -Using of "all in one line" like "internal void UpdateLastProcessedCTVirtualInsetFromVPStart() { lastProcessedCTVirtualInsetFromVPS = ctVirtualInsetFromVPS_Cached; }" really dont help to read :p
    -use parenthesis, avoid "return 1d + insetClamped / vsa;" It 's more readable. If you have * and / in the same lines, it avoids calculating priority problems
    - always use a space between 2 methods. Some blocs in OSASubComponent are a little "compact" at line 310
    -avoid big nested classes, create a file for each nested class and use Internal visibility. The OSASubComponent.cs is totally unreadable. Create a .cs for each class. Avoid to use the "Partial" keyword to create nested classes, it's not c# compliant. 1 class, 1 file, except for small nested class. The OSA class don't require Partial use :p
    -strange code : " bool _; SetContentVirtualInsetFromViewportStart(newInset, ref p, out _);". If the out parameter is not always needed, create 2 methods with and without it, and first methods calls the second
    -be care to the use with the nullables like double?, remember that all nullable takes 2 data in memory ! the data itself of course and a bool to store the null state, and the Value is a method with a If statement. In a code that is not executed many time and for temporary data, it's ok ;) Avoid to use it for permanent store or in Update method
    -you use a lot of double, I think float will be enough ;) double takes more memory. Remember that you should always use the less memory and CPU as possible
    -you use some int, so there are Int32, but a Int16 could be enough (itemIndex for example). For the performance and memory, use always the smaller data as possible. If a byte or sbyte is enough, use it. So don't use "var" for value type, to control the exact type used in IL

    Hope it helps ;)
     
  17. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    Paid attention to the warnings, I think that there is some possible bugs ;) like GridParams._CellPrefab, used but never assigned before, so always null :p
    This is the serialized fields, you should affect some default values.
     
  18. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    Méthode public void Init() in OSA class, at end, you have :
    if (Initialized != null)
    Initialized();
    Use the c# pattern, call a method virtual OnInitialized, and this method does the above code
    Actually I must use your event in my derived class, I should override a method
     
  19. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    Moreover, the use of :
    public virtual event Action Initialized;
    is not the common c# pattern
    Why the inherited class should set it ? why not set it in the abstract class ?
     
  20. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    Hi,
    The GridAdapter.InsertItems and RemoveItems are not implemented ??
    I have to reset the grid ? hum, not the best performance :(
    A possible release date ?
    Thanks
     
  21. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    The Content Spacing work well for List, but for Grid, distinct X and Y spacing are really necessaries
    For my Horizontal Grid I have not the same spacing to apply for X and Y, to get the best look
    A possible release date ? Not really difficult to do :p
     
  22. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Thanks for your siggestions!
    Can you please send me an email with all of them? People that read this thread don't really care about them so better keep the thread only for q&a :)
    I'll come back with answers to your questions as soon as I'll fix some urgent problems in another project of ours.

    Lucian
     
  23. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    Hi,
    Ok, I send you a mail with all this messages :)
    Thanks,
    Lord Belasco
     
  24. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Noted.

    Definitely no bugs here. Just warnings that only appear in the code editor. But yes, it should be avoided if possible. Added it to the to-do list, among other similar warnings :)

    No ETA yet.

    You can set Params.ContentSpacing as before, which is the space between the columns in this case, and also Params.grid.spacingInGroup, which in your case will be the space between the rows. The latter only works if set at the beginning, preferably through inspector.
    Both of them can be set from the inspector or from code.
     
  25. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    It works fine :cool:

    Thanks
     
  26. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    Is there an option to automatically set the height of the GridView according to its content ?
    I have 2 GridView in a Vertical Layout, and only the second is allowed to grow (flexible height), the first should have a height corresponding th the height content (1 to 3 lines)
    Actually, I do the calculation and set the MinHeight to the layout element
    May be I dont see an existing option ?
    Thanks
     
  27. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    Could these components be used by code ? So, without using the serialization. If yes, in this case it's better to set default values. Sometimes I prefer to re implement the serialization to store only the values that are differents from the defaults. Better for performance and size. I use the DefaultValueAttribute class, and set all the values by code following these attributes
     
  28. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    If this is outside the ScrollView, we have little control of that. The ScrollView's RectTransform can't be resized by the plugin (it can, but it's out of our scope), we only respond to external size changes to it (like when it's resized due to orientation change on mobile), but I'm sure it'll behave consistently with Unity's Layout system if you set its min/preferred Height. You can use OSA.GetContentSizeToViewportRatio() (extension method) as a hint if needed. It'll be equal to contentSize divided by viewportSize.

    Currently the _Params field in OSA.cs is serialized and used as such. I didn't test using only plain classes, but maybe you'll be able to. You can email me with your results, if you'll have time to try this, so I can put it on the to-do list.
    Do a backup first, and then try removing the Serialized attribute on it, and the Serializable attributes on the BaseParams and classes derived from it. But this will mean you'll affect every OSA implementation on your project.
    Make sure to test it well.
     
  29. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    I calculate the size of content, following the orientation, and set the layout element properties (min width or heigth). If I delete or add a item in the datas, I recalculate the size and set it again. It could be a possible option and you can find the Layout Element and set it
    Not a a priority request, easy to do it, I just ask if I miss it ;)
    Thanks
     
    xucian likes this.
  30. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    This is actually a good idea. I think only now I got it. If not, you at least gave me a nice idea.
    You want the SV's size to be variable within some range, like min contentSizr, max screenHeight. If content's size exceeds screenHeight, the SV's size remains the same and scrolling will become enabled. Formally, SV height = min(contentSize, screenHeight).
    Is this what you meant?
     
  31. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    I use a GridView to display level informations to player, on top or left, following the screen size. This grid is "only" a part of displayed informations in the menu bar (that is the master horizontal/vertical Layout Group). So I limit the size of this grid view to get enough space for others informations. The informations are added and deleted, following the player actions. I use 2 columns in vertical and 2 lines for horizontal mode. I limit the size to 4 lines or 4 columns for respective mode. And I can have no information to display and after 2 or 3 or more, and after again back to no information.
    So the min is 0 and the max is the calculated content size for 4 lines or 4 columns following vertical/horizontal
    I calculate the size of the GridView when the data has changed, to get always the minimum height/width
    All the informations in the menu bar are dynamically resized to the min possible size
    It's automatically done for "basics" Layout group, not for GridView ;)
     
  32. sp-sergio-gil

    sp-sergio-gil

    Joined:
    Mar 5, 2014
    Posts:
    45
    Hi all!

    I recently bought the latest version of this plugin and I'm trying to implement some stuff with a horizontal scroll with SNAP and LOOP ITEMS .

    The first things I would have is start the popup with the first element centered but I cannot do it properly. If in start i create the elements I can see the elements not centered. If I force a ScrollTo after inserting the elements, I can se the moving animation. How can I start the popup with the first element centered?

    Another question is that this scrollview will have ability to automatically smooth snap to next element every X seconds. I'm trying to get the use SmoothScroll call using the _LastSnappedItemIndex + 1 to get the next one, but then I'm having troubles with the check

    Code (CSharp):
    1. float distanceToTarget;
    2.             var middle = GetMiddleVH(out distanceToTarget);
    3.             //if (middle == null)
    4.             //    Debug.Log("null");
    5.             if(middle == null)
    6.                 return;
    7.  
    8.             _SnapNeeded = false;
    9.             if(distanceToTarget <= snapAllowedError)
    10.                 return;
    because instead of snapping to the next, It's getting the centered one and If I use a positive value in snapAllowedError then I never have the SmoothScroll that is below... Is this correct? I mean if I use a negative value in snapAllowedError it works because it skips this check but I don't know the implications for this or if I'm doing something wrong.

    A part from this, the snapper, perhaps can return the updated _LastSnappedItemIndex index in the
    SnappingEndedOrCancelled call?

    Thanks!!!
     
  33. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Hey,

    Subscribe to Initialized event and call ScrollTo when it fires. You shouldn't see the movement here.
    Let me know if this works.

    For the second thing, you can call SmoothScrollTo whenever you can, it doesn't need to actually wait for the previous animation to end.
    Just call it once every x seconds, given the duration of the animation is x seconds.

    Let me know if this helped

    Lucian
     
  34. sp-sergio-gil

    sp-sergio-gil

    Joined:
    Mar 5, 2014
    Posts:
    45
    The thing is that I need to start with the first element centered and snapped, but without seeing the animation, how can I achieve this directly?

    If I use a ScrollTo it moves the actual list to the first but I don't want to see the movement
     
  35. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Hey

    One way of doing it is to have a CanvasGroup on the ScrollView with alpha=0, and after you're sure the item is scrolled, set alpha=1 or simply remove the CanvasGroup.
    If you instead meant that you want to see some space between the beginning of the ScrollView and the first element, then use the contentPadding property in the OSA's inspector.

    Let me know if this helped

    Lucian
     
  36. sp-sergio-gil

    sp-sergio-gil

    Joined:
    Mar 5, 2014
    Posts:
    45
    The thing is that i really need to open my popup, setup the values for the scroll and start with the scrollview centered in the first element without noticing it (animation,...) I will try the canvas group thing, but I guess that doing it this way I will not see anything in the scrollview in the time the scroll is being centered and then suddlenly we will see all the elements... This is not the approach that I need

    I need to start with the scroll centered, not wait for it to center (seing it or hiding it with a canvas group)

    Any other fast solution? touching your code elsewhere could fix this?

    Another thing is why the scrollto is not immediate? how can do a scrollto immediate?
     
  37. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Are you using ScrollTo or SmoothScrollTo?
     
  38. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    If I call the below method via Button click, I get different values, so the item's RectTransform is being moved immediately:
    Code (CSharp):
    1.         public void TestScrollToImmediacy()
    2.         {
    3.             // For the test to be valid make sure we're at a different position than 2. Or make sure to manually drag the content to some random position before calling this method
    4.             ScrollTo(0);
    5.  
    6.             var vh = GetItemViewsHolderIfVisible(3);
    7.             var cur = GetItemRealInsetFromParentStart(vh.root);
    8.             ScrollTo(2);
    9.  
    10.             // Same item(index), but may have a different VH, so we retrieve it again
    11.             var vh2 = GetItemViewsHolderIfVisible(3);
    12.             var cur2 = GetItemRealInsetFromParentStart(vh2.root);
    13.  
    14.             Debug.Log(cur + ", " + cur2); // different
    15.         }
    Don't you get the same behavior?
     
  39. sp-sergio-gil

    sp-sergio-gil

    Joined:
    Mar 5, 2014
    Posts:
    45
    If I do this I'm having different values, but again the scroll is visual.

    Perhaps is something from my code?

    Code (CSharp):
    1.  
    2.  
    3.     public void InitData(Data data)
    4.     {
    5.         Start();
    6.  
    7.         _Params.Data.Clear();
    8.      
    9.         foreach(var d in  data)
    10.         {
    11.             var model = new CharacterModel();
    12.             model.Data = d;
    13.  
    14.             _Params.Data.Add(model);
    15.         }
    16.      
    17.         ResetItems(_Params.Data.Count);
    18.  
    19.         _Params.Snapper.SnappingEndedOrCancelled += FinishSnapping;
    20.      
    21.         ScrollTo(0);
    or my prefab values?
     

    Attached Files:

  40. sp-sergio-gil

    sp-sergio-gil

    Joined:
    Mar 5, 2014
    Posts:
    45
    Another thing is how can I force to stop immediatelly the scrolling... I mean I want to drag a cell but if we do a fast scroll and I drag it, when I leave it it get's stuck?

    I'm using my own code to do the drag and drop and when the drag starts I perform a StopMovement but the scroll keeps scrolling
     
  41. sp-sergio-gil

    sp-sergio-gil

    Joined:
    Mar 5, 2014
    Posts:
    45
    Isf I use in my InitData this code
    Code (CSharp):
    1.        ResetItems(_Params.Data.Count);
    2.  
    3.         _Params.Snapper.SnappingEndedOrCancelled += FinishSnapping;
    4.        
    5.         var vh = GetItemViewsHolderIfVisible(0);
    6.         var cur = GetItemRealInsetFromParentStart(vh.root);
    7.        
    8.         ScrollTo(0);
    9.         // Same item(index), but may have a different VH, so we retrieve it again
    10.         var vh2 = GetItemViewsHolderIfVisible(0);
    11.         var cur2 = GetItemRealInsetFromParentStart(vh2.root);
    12.         Debug.Log(cur + ", " + cur2); // different
    I'm getting different values but again the scroll is visible
     
  42. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Hi again,

    Because this is a very particular case and probably won't be of use to other users, let's continue via email only (lucian@thefallengames.com)
    Please send me a video with what happens and describe me exactly what's wrong in it and how it should be.
    Please also send me your whole project, if possible, or at least all the scripts which you encounter these problems with.

    Lucian
     
  43. sp-sergio-gil

    sp-sergio-gil

    Joined:
    Mar 5, 2014
    Posts:
    45
    I think that is not a particular case and can be extrapolated to a lot of people, but as you are requesting I will try to create a example of what we need and send it to you ASAP
     
  44. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Replied to your email. For anyone else that want to align an item in the center of the viewport, check the documentation of ScrollTo, to see how it works. The code is:
    Code (CSharp):
    1. ScrollTo(itemIndex, .5, .5); // bring the center of the item to the center of the viewport
     
  45. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    When can we hope to have a new release without the warnings ?
     
  46. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    I guess you're referring to those you mentioned above.
    In a month or so, we'll do some la finesse changes to the code and hopefully remove warnings even for different unity versions.
    If the next release is too late for you, I'm pretty sure you can get rid of most of them by yourself without affecting the plugin's functionality whatsoever
     
  47. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    hum... ok, I'll do the modifications in the code, your warnings hide the visibility of mines. I'm a little tired to correct the Unity plugins, you are not the first to answer to do it myself
     
  48. Airship

    Airship

    Joined:
    Sep 10, 2011
    Posts:
    260
    What is your recommendation for a scroll view that needs both content size fitters and to download image data. I don't know the dimensions of the images until they are downloaded, and when they are downloaded, the view's size needs to update with a content size fitter. It looks like
    ScheduleComputeVisibilityTwinPass can only be called during UpdateViewsHolder.

    I was hoping to start the download in UpdateViewsHolder to get the image (if not cached locally) and then when that completes, call ScheduleComputeVisibilityTwinPass to update the sizes. However, I get an error saying ScheduleComputeVisibilityTwinPass can only be called during UpdateViewsHolder or OnItemIndexChangedDueInsertOrRemove. I have looked at your examples for content size fitter and grid example which uses an image downloader, but don't see a way to combine the functionality. Is this possible?
     
  49. LordBelasco

    LordBelasco

    Joined:
    May 1, 2017
    Posts:
    29
    Hi,
    Sometimes, I disabled some components in the Awake (like my UI dialogs, that are active in the editor), so the GridView is also disabled in the awake of my main MonoBehaviour. If the Grid is never activated, I get an exception :
    Assets.Scripts.UI.WorldManagement.LevelsListAdapter.ClearVisibleItems () (at Assets/Scripts/UI/WorldManagement/LevelsListAdapter.cs:60)
    Com.TheFallenGames.OSA.Core.OSA`2[TParams,TItemViewsHolder].Dispose () (at Assets/OSA/Scripts/Core/OSA.cs:1201)
    Com.TheFallenGames.OSA.Core.OSA`2[TParams,TItemViewsHolder].OnDestroy () (at Assets/OSA/Scripts/Core/OSA.cs:127)
    A "if" is missing before _ReleaseFromPull.inProgress = false in the ClearVisibleItems
    I have overriden the ClearVisibleItems to avoid this exception (I check IsInitialized to call the base)
     
  50. AlfredL

    AlfredL

    Joined:
    Sep 10, 2013
    Posts:
    27
    I am trying to use the OSA with TouchScript (https://github.com/TouchScript/TouchScript). However, I notice there is some issue when running OSA with TouchScript on iPhone. TouchScript has its own input module, which replaces the standalone input module. However, when I try to scroll the list, the list always jumps up on the first move. Has anyone run into this type of issue? It will be greatly appreciated if anyone can shed some light on how to solve it.