Skip to content

Commit c7cdad2

Browse files
committed
Add "Add Cell" and "Remove Cell" buttons to sample scene
1 parent 57f6cc8 commit c7cdad2

File tree

3 files changed

+479
-5
lines changed

3 files changed

+479
-5
lines changed

Samples~/ScrollView/AddRemoveCell.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using UnityEngine;
2+
3+
namespace Gilzoide.FlexUi.Samples.ScrollView
4+
{
5+
public class AddRemoveCell : MonoBehaviour
6+
{
7+
[SerializeField] private RectTransform _viewportContent;
8+
[SerializeField] private RectTransform _cellPrefab;
9+
10+
public void AddCell()
11+
{
12+
Instantiate(_cellPrefab, _viewportContent);
13+
}
14+
15+
public void RemoveCell()
16+
{
17+
Destroy(_viewportContent.GetChild(_viewportContent.childCount - 1).gameObject);
18+
}
19+
}
20+
}

Samples~/ScrollView/AddRemoveCell.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)