So i am following UNITY tutorial and in junior programming, in that i am at a project where i have to loop the background i am foloowing same code but it isn't working on my side

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

public class ScriptRepeat : MonoBehaviour
{
private Vector3 startPos;
// Start is called before the first frame update
void Start()
{
startPos= transform.position;
}

// Update is called once per frame
void Update()
{
    if(transform.position.x < startPos.x - 60)
    {
        transform.position = startPos;
    }
    
}

}

You should deduct the exact width of the repeating background, and it is probably not 60. Here is my version for the same tutorial:

    // Start is called before the first frame update
    void Start()
    {
        startPos = transform.position;
        repeatWidth = GetComponent<BoxCollider>().size.x / 2;
    }

    // Update is called once per frame
    void Update()
    {
        if (transform.position.x < startPos.x - repeatWidth)
        {
            transform.position = startPos;
        }
    }