Collided object to follow player at different offsets?

Hi all! I’m a complete noob to Unity and C sharp so please bear with me!!
I’m making an android game where you need to catching falling objects. I want to make it so that when one object (which are randomly spawning prefabs) is caught, it will then follow the player and be kept by the player. When the player catches a 2nd object, it will also follow the player but have a different offset on the X axis. This will continue until the player catches 4 objects.

I’ve managed to create a follow player script when collided. But I really have no idea how to offset for each object collected. At the moment the 2nd object will be in the exact same position as the first which is logical from the code. I’m guessing I have to use Coroutines but just don’t have the knowledge to properly write this.

Again sorry for my really basic code, I’m still in the learning process. This is all the code relating to the collision and object movement which is attached to the falling prefabs:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NoteBehaviour : MonoBehaviour
{
    private Rigidbody playerRb;
   private PlayerController playerController;
    float distanceWanted = 1f;

    public bool isCaught;

    void Start()
    {
        playerRb = GameObject.Find("Player").GetComponent<Rigidbody>();
        playerController = GameObject.Find("Player").GetComponent<PlayerController>();
    }

    void Update()
    {
        if (isCaught == false)
        {
            transform.Translate(Vector3.down * Time.deltaTime * speed);

            if (transform.position.y < lowerBound)
            {
                gameObject.SetActive(false);
            }
        }
    }

    private void FixedUpdate()
    {
        if (isCaught == true)
        {
            FollowPlayer();           
        }
    }

     void FollowPlayer()
     { 
          Vector3 diff = transform.position - playerRb.position;
          Vector3 offset = new Vector3(-.3f, -1.5f, playerRb.position.z);
          diff.z = 0f;

          transform.position = Vector3.MoveTowards(playerRb.position, diff.normalized, distanceWanted) + offset;

     }

    private void OnTriggerEnter(Collider other)
    {
        if (gameManager.isGameActive && other.CompareTag("Player"))
        {
            isCaught = true;
            playerController.amountHeld += 1;
        }

    }

It seems like you just need each object to remember its position in the chain of objects following the player.

In the version of the code below, I’ve added a position variable that gets set to the appropriate value when isCaught is set and is used when calculating the X offset in FollowPlayer().

If objects can be removed from the chain of objects following the player, then you’ll need some way to update this position value at that time.

     int position = 0;

     void FollowPlayer()
     { 
          Vector3 diff = transform.position - playerRb.position;
          Vector3 offset = new Vector3(-.3f * position, -1.5f, playerRb.position.z);
          diff.z = 0f;

          transform.position = Vector3.MoveTowards(playerRb.position, diff.normalized, distanceWanted) + offset;

     }

    private void OnTriggerEnter(Collider other)
    {
        if (gameManager.isGameActive && other.CompareTag("Player"))
        {
            isCaught = true;
            position = playerController.amontHeld;
            playerController.amountHeld += 1;
        }

    }