How to move a GameObject one after the other without having any gaps?

I’m trying to build a clone to this game.
(, but I’m having trouble creating the walls.

I have two groups of 30 GameObjects. One for the top wall and another group for the bottom wall.
Like so:


Each one has a script that moves the wall to the left, Here is the script:

    public static float lvl = 0f;

    private void Update()
        float amtToMove = Time.deltaTime * LevelManager.Instance.wallSpeed;

            transform.Translate(Vector3.left * amtToMove);
            if(transform.localPosition.x < 0)

    public void Reset()
        lvl += 0.09f;
        transform.localPosition = new Vector3(30f, transform.localPosition.y + Mathf.Sin(lvl), 0); 

As the game continues LevelManager.Instance.wallSpeed changes value.

The problem with this, is that eventually it “breaks” and leaves a gap between each wall. Like so:


Is there a fix for this? I don’t quite understand what I’m doing wrong.

Hi @nyanku

One solution could be like this:

If your wall blocks move towards left, check when the leftmost wall block removes itself.

When this happens, create a new block. New block should be placed relative to first block on right.
If all your blocks are 1m wide, then place the new piece to rightMostPiece.transform.position + Vector3.right (one unit from it’s position). This way I think it doesn’t matter if blocks are moving faster than default speed, new block will just line up itself with the previously newest block.