Lerping a group of objects by the same amount

Hey guys, just trying to settle a small problem. I’m trying to lerp a group of objects (no, I can’t parent them to one single parent and move that–you’ll see why in a minute) by the same interval in the same timespan, and I was trying to figure out the most efficient way of doing this.

Detailed version (to clarify what this is for if the above isn’t clear enough): The main menu of the game I’m currently working on allows the user to scroll through the available options using the mouse wheel, over a set time interval. Eventually, what I’d like to do is make the menu appear ‘infinite’ by teleporting (or rather, changing the transform) of the menu items either to the initial position on the positive side or the initial position on the negative side. I’ve obscured this using clever camera angles and fog with depth of field, but that’s not exactly the point of this post–I just need to get the objects to lerp when they scroll wheel is used.

This is the code I was using. The documentation is very unclear on exactly what context to use coroutines in (and I’m sure I’m using them incorrectly here) but this was my best attempt:

using UnityEngine;
using System.Collections;

// MAKE SURE DELTA MOUSE SCROLL SENSITIVITY IS CORRECTLY CONFIGURED

public class MenuScroller : MonoBehaviour {

	public Transform[] menuObjects = new Transform[4];
	private bool scrollingInProgress = false;
	private int scrollValue = 0;
	private float lerpDistance = 2.5f;
	public float scrollTime = 0.35f;
	
	// Update is called once per frame
	void Update () {
		if (!scrollingInProgress) {
			if (Input.GetAxis("Scroll Wheel") != 0) {
				scrollingInProgress = true;
				scrollValue = (int)Input.GetAxis("Scroll Wheel"); // I set it up as Scroll Wheel in the input manager, this is correct
			}
		} else {
			if (scrollValue > 0) {
				doLerp(true);
			} else if (scrollValue < 0) {
				doLerp(false);
			}
			
			if (scrollValue != 0) scrollValue = 0;
		}
	}
	
	IEnumerator doLerp(bool d) {
		float incrementValue;
		if (d) incrementValue = lerpDistance;
		else incrementValue = lerpDistance * -1.0f;
		while (true) {
			for (int i = 0; i < menuObjects.Length; i++) {
				menuObjects[i].localPosition = Vector3.Lerp(menuObjects[i].localPosition, new Vector3(menuObjects[i].localPosition.x, menuObjects[i].localPosition.y, menuObjects[i].localPosition.z+incrementValue), Time.deltaTime * scrollTime);
			}
			yield return null;
		}
	}
}

Any suggestions or ways to improve the code so that it works? Or should I scrap what I have in favor of a different method?

You really could simplify it by just having all the menuitems be children of one transform (so everything moves with it). one thing you could do for the looping menu is if you had it set up with everything being children of the one transform, once a object at the bottom of the list needs to be at the top of the list just modify the localPosition to be the highest child’s + spacing and vice versa. This all assumes you’ve got enough things in there where you can loop whats on screen. Just a thought though.