How do I get the next item in a list?

Hi,

I want to make a hint system where you can buy/unlock the next hint/objective whenever you click on a button.

I looked at System.Linq, but I am not sure how to do this right.

The sample below activates all hints when I press a button.

public void UnlockHint()
    {
        for (int i = 0; i < Hints.Count; i++)
        {
            if(!Hints_.isUnlocked && !Hints*.isDone)*_

Hints*.isUnlockable = true;*

if(Hints*.isUnlockable)*
Hints*.isUnlocked = true;*
}
}
Thanks,
Tim

Solved it by adding a counter. Whenever I press a button, do counter++. So the for loop was unnecessary.

Example:

    public void UnlockHint()
    {
        if (unlockCounter >= Hints.Count)
            return;
        
        if (!Hints[unlockCounter].IsUnlocked && !Hints[unlockCounter].IsDone)
            Hints[unlockCounter].IsUnlockable = true;

        if (Hints[unlockCounter].IsUnlockable)
        {
            Hints[unlockCounter].IsUnlocked = true;
            Hints[unlockCounter].IsUnlockable = false;
            unlockCounter++;
        }
    }

Next time I would explain my problem better.

Thanks for the help :slight_smile: