Collecting game objects in specific order

I have some objects that need to be collected. Each object has a number assigned (1,2,3,etc).

How would I go about making sure these objects are collected in the order they are numbered?

The logic for such a situation will go as below:

  • Set an integer variable for last collected item like lastItemCollected.

  • Then when user tries to collect an item check if that item is lastItemCollected+1.

  • If yes then add that item to your collected items list and update the value of lastItemCollected by one.

  • If not then do not allow to collect that object.

You need to tweak this logic to suit your needs. :slight_smile: