How to flick back and forth in an inventory?

Hi, I’m having an issue creating an inventory system, that it will be possible to flick back and forth through and increases in size to always hold the current amount of items, but never less than 10.

As far as I’ve seen people creating inventories they always display everything on the screen at the same time, which considering my inventory (in theory) can hold up to 60 items would make it a bit complicated. Instead I have been looking for a way to by defeault display item 0 through 9, and by clicking an arrow button, it would display item 1 - 10, 2 - 11, 3 - 12 and so forth until the items stop, at which the right arrow becomes inactive until another item is added.

[120315-example.png*_|120315]

This picture is a mockup of what I’m aiming for, by clicking the right arrow, all items would move 1 square left and vice versa, but as the purple ring is the last item displayed, the right arrow would be inactive. I have used the template provided by Unity’s Adventure Game asset.

Code (CSharp):

using UnityEngine;
using UnityEngine.UI;
 
public class Inventory : MonoBehaviour
{
    public Image[] itemImages = new Image[numItemSlots];    // The Image components that display the Items.
    public Item[] items = new Item[numItemSlots];           // The Items that are carried by the player.
 
 
    public const int numItemSlots = 10;                      // The number of items that can be carried.  This is a constant so that the number of Images and Items are always the same.
 
 
    // This function is called by the PickedUpItemReaction in order to add an item to the inventory.
    public void AddItem(Item itemToAdd)
    {
        // Go through all the item slots...
        for (int i = 0; i < items.Length; i++)
        {
            // ... if the item slot is empty...
            if (items *== null)*

{
// … set it to the picked up item and set the image component to display the item’s sprite.
items = itemToAdd;
itemImages*.sprite = itemToAdd.sprite;*
itemImages*.enabled = true;*
return;
}
}
}

// This function is called by the LostItemReaction in order to remove an item from the inventory.
public void RemoveItem (Item itemToRemove)
{
// Go through all the item slots…
for (int i = 0; i < items.Length; i++)
{
// … if the item slot has the item to be removed…
if (items == itemToRemove)
{
// … set the item slot to null and set the image component to display nothing.
items = null;
itemImages*.sprite = null;*
itemImages*.enabled = false;*
return;
}
}
}
}
I’m a bit reserved about asking for help to something that some would consider simple, but I just can’t find anything that describes, exactly what I want to create. Any tips or help would be appreciated.
_*

Hi, you could create a counter to know in wich position of the inventory you are. If you hit the right arrow you increase the counter +1, if you press the left arrow you do -1. Then you can do something like:

for (int i = 0; i < 10; i++)
{
itemImages*.sprite = items[i + counter].sprite;*

}
if you hit the right arrow 3 times the counter will be 3 and you will take the items from 0 + 3 to 9 + 3 that is 3 - 12.
----------
Then you must create a condition to know if you are at the end of the inventory and you cant click the right/left arrow anymore for example:
if (counter = 0)
{
//Cant press the left arrow anymore
}
if (counter = items.Lenght - 10)
{
//Cant press the right arrow anymore
}

This has really made me think and I hope to read more. Would you like to know the details of ASTC Notification.