Callbacks
3_ScriptableList
OnItemAdded / OnItemRemoved
Useful if you want to do different things depending on if an item is added or removed. To see an example of this, click on the VfxSpawner.cs.
Here we want to display a different VFX depending on if a player has been spawned or destroyed. The player argument is useful, as we can get its position and spawn the VFX there.
OnItemCountChanged
This event is useful if you only care about when the number of elements in the list is changed.
The example for this one is the ListCount.cs
Scene Hierarchy: UICanvas/Bottom/ListCount
We simply update the text with the number of elements in the list.
OnItemsAdded / OnItemsRemoved
This event is useful if you don’t want the OnItemAdded/OnItemRemoved event triggered every time you add/remove an item. This will be called once after a range of items have been added/removed.
Last updated