Tanoda
UnityEngine.UI.Extensions.UI_ScrollRectOcclusion Class Reference

ScrollRectOcclusion - disables the objects outside of the scrollrect viewport. Useful for scrolls with lots of content, reduces geometry and drawcalls (if content is not batched) More...

Inheritance diagram for UnityEngine.UI.Extensions.UI_ScrollRectOcclusion:

Public Member Functions

void Init ()
 
void OnScroll (Vector2 pos)
 

Public Attributes

bool InitByUser = false
 

Detailed Description

ScrollRectOcclusion - disables the objects outside of the scrollrect viewport. Useful for scrolls with lots of content, reduces geometry and drawcalls (if content is not batched)

Fields

  • InitByUSer - in case your scrollrect is populated from code, you can explicitly Initialize the infinite scroll after your scroll is ready by calling Init() method

Notes

  • In some cases it might create a bit of spikes, especially if you have lots of UI.Text objects in the child's. In that case consider to Add CanvasGroup to your child's and instead of calling setActive on game object change CanvasGroup.alpha value. At 0 it is not being rendered hence will also optimize the performance.
  • works for both vertical and horizontal scrolls, even at the same time (grid layout)
  • in order to work it disables layout components and size fitter if present (automatically)

Definition at line 26 of file UI_ScrollRectOcclusion.cs.

Member Function Documentation

◆ Init()

void UnityEngine.UI.Extensions.UI_ScrollRectOcclusion.Init ( )

Definition at line 51 of file UI_ScrollRectOcclusion.cs.

◆ OnScroll()

void UnityEngine.UI.Extensions.UI_ScrollRectOcclusion.OnScroll ( Vector2  pos)

Definition at line 116 of file UI_ScrollRectOcclusion.cs.

Member Data Documentation

◆ InitByUser

bool UnityEngine.UI.Extensions.UI_ScrollRectOcclusion.InitByUser = false

Definition at line 29 of file UI_ScrollRectOcclusion.cs.


The documentation for this class was generated from the following file: