Beispiel #1
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.P))
     {
         _scrollRect.AddItem(totalCount++, true);
     }
     if (Input.GetKeyDown(KeyCode.O))
     {
         _scrollRect.RemoveItem(NumToDelete++, true);
     }
 }
Beispiel #2
0
        void Start()
        {
            _scrollRect = GetComponent <LoopScrollRect>();
            var dataSource = new LoopScrollPrefabSource();

            dataSource.prefabName = ObjectResourceName;
            _scrollRect.Init(dataSource, LoopScrollSendIndexSource.Instance);
            for (int i = 0; i < totalCount; i++)
            {
                _scrollRect.AddItem((object)i, false);
            }

            _scrollRect.RefillCells();
        }