All Projects → qiankanglai → Loopscrollrect

qiankanglai / Loopscrollrect

Licence: mit
These scripts will make your UGUI ScrollRect reusing cells, to improve performance, loading time and draw calls.

Labels

Projects that are alternatives of or similar to Loopscrollrect

Factory
Factory for object creation and dependency injection. Works with normal C# apps or under Unity3d
Stars: ✭ 50 (-95.48%)
Mutual labels:  unity3d
Qp.framework
基于xLua的全Lua热更新框架
Stars: ✭ 55 (-95.03%)
Mutual labels:  unity3d
Unity3d Ai And Procedural Generation Framework
Unity3D AI and Procedural Generation Framework.
Stars: ✭ 58 (-94.76%)
Mutual labels:  unity3d
Urfairy
C# extensions for Unity development
Stars: ✭ 51 (-95.39%)
Mutual labels:  unity3d
Unihumanoid
Unity humanoid utility with bvh importer.
Stars: ✭ 54 (-95.12%)
Mutual labels:  unity3d
Voxelman
Unity ECS + C# Job System example
Stars: ✭ 1,086 (-1.9%)
Mutual labels:  unity3d
Revealshader
Unity Shader experiment
Stars: ✭ 47 (-95.75%)
Mutual labels:  unity3d
Entityselection
A minimal solution for selecting entities in the unity sceneview.
Stars: ✭ 60 (-94.58%)
Mutual labels:  unity3d
Unity3d Quicksearch
A Command Palette for Unity
Stars: ✭ 54 (-95.12%)
Mutual labels:  unity3d
Unityasync
Task and Async Utility Package for Unity. Start co-routines from anywhere.
Stars: ✭ 58 (-94.76%)
Mutual labels:  unity3d
Meshstreaminggrasshopper
Plugin for Grasshopper to stream mesh geometry through web socket.
Stars: ✭ 52 (-95.3%)
Mutual labels:  unity3d
Shadergraph Custom Nodes
🔨 Collection of custom nodes for ShaderGraph.
Stars: ✭ 53 (-95.21%)
Mutual labels:  unity3d
Voxelframework
An awesome Voxel framework for Unity (Game Engine)
Stars: ✭ 57 (-94.85%)
Mutual labels:  unity3d
Unity Extensions
Useful extension methods for Unity.
Stars: ✭ 50 (-95.48%)
Mutual labels:  unity3d
Trajectorytutorial
Shoot arrows & missiles in 3D space using projectile motion physics in Unity3D
Stars: ✭ 58 (-94.76%)
Mutual labels:  unity3d
Kino
A collection of custom post processing effects for Unity
Stars: ✭ 1,054 (-4.79%)
Mutual labels:  unity3d
X Postprocessing Library
Unity Post Processing Stack Library | Unity引擎的高品质后处理库
Stars: ✭ 1,079 (-2.53%)
Mutual labels:  unity3d
Unity.webp
🎨 WebP made easy for Unity3d
Stars: ✭ 59 (-94.67%)
Mutual labels:  unity3d
Unity3d Curves
2D curves in polar and Cartesian coordinates, 3D curves, surfaces and fractals for the Unity3D game engine.
Stars: ✭ 59 (-94.67%)
Mutual labels:  unity3d
Nnao
Neural Network Ambien Occlusion based on http://theorangeduck.com/page/neural-network-ambient-occlusion
Stars: ✭ 57 (-94.85%)
Mutual labels:  unity3d

Loop Scroll Rect

v1.05

These scripts help make your ScrollRect Reusable, because it will only build cells when needed. If you have a large number of cells in a scroll rect, you absolutely need it! It will save a lot of time loading and draw call, along with memory in use, while still working smoothly.

中文说明请看这里

Demo

Demo for Loop Scroll Rect. Each cell knows its own index, and it is able to modify its content/size/color easily.

Also ScrollBar is supported now! It supports both vertical & horizontal directions, back and forth.

Demo1

Demo2

Demo without mask. As you can see, the cells are only instantiated when needed and recycled.

Demo3

New: Scroll to Index

ScrollToIndex

Introduction

The original idea comes from @ivomarel's InfinityScroll. After serveral refactorisations, I almost rewrite all the codes:

  • Avoid using sizeDelta directly since it doesn't always mean size
  • Support GridLayout
  • Avoid blocking when dragging back
  • Take advantage of pool rather than instantiate/destroy every time
  • Improve some other details for performance
  • Supports reverse direction
  • Supports ScrollBar (this doesn't work in Infinite mode, and may behavior strange for cells with different size)

Also, I modified Easy Object Pool for recycling the cells.

My scripts copies ScrollRect from UGUI rather than inherit ScrollRect like InfinityScroll. I need to modify some private variants to make dragging smooth. All my codes is wrapped with comments like ==========LoopScrollRect==========, making maintaining a little easier.

Infinite Version

If you need scroll infinitely, you can simply set totalCount to a negative number.

Quick Jump

I've implemented a simple version with Coroutine. You can use the following API:

public void SrollToCell(int index, float speed)

Here is a corner case unsolved yet: You can't jump to the last cells which cannot be pulled to the start.

Example: Loop Vertical Scroll Rect

These steps may be confusing, so you can just open the demo scene and copy & paste :D

You can also remove EasyObjPool and use your pool instead.

  • Prepare cell prefabs
    • The cell needs Layout Element attached and preferred width/height
    • You should add a script receiving message void ScrollCellIndex (int idx)

ScrollCell

  • Right click in Hierarchy and click UI/Loop Horizontal Scroll Rect or UI/Loop Vertical Scroll Rect. It is the same for these two in the Component Menu.
    • Init in Start: call Refill cells automatically when Start
    • Prefab Pool: the EasyObjPool gameObject
    • Prefab Pool Name: the corresponding pool in step 1
    • Total Count: How many cells are available (index: 0 ~ TotalCount-1)
    • Threshold: How many additional pixels of content should be prepared before start or after end?
    • ReverseDirection: If you want scroll from bottom or right, you should toggle this
    • Clear Cells: remove existing cells and keep uninitialized
    • Refill Cells: initialize and fill up cells

LoopVerticalScrollRect

If you need scroll from top or left, setting content's pivot to 1 and disable ReverseDirection. Otherwise, you should set 0 to pivot and enable ReverseDirection (I have made VerticalScroll_Reverse in the demo scene as reference).

I highly suggests you trying these parameters by hand. More details can be found in the demo scene.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].