Unity中有很多地方需要列表,但展示的项目过多,就不能全部创建,太耗性能,这样做也会被boss骂死,这就需要动态列表
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
namespace DynamicGridFloader
{
public class DynamicGrid : MonoBehaviour
{
public float cellX;
public float cellY;
public float space;
public GameObject prefab;
private ScrollRect _scrollRect;
private RectTransform _scrollRectRectT;
private RectTransform _content;
private int _previousTopIndex = -1;
private int _pageCount;
private bool _firstIni = true;
private List<Cell> _activeList = new List<Cell>();
private List<Cell> _catchList = new List<Cell>();
private List<CellVo> _dataList = new List<CellVo>();
void Awake()
{
creat();
}
void Upd