Instantiating prefab causes existing instances to change values

I want to instantiate obstacles so I have a controller to instantiate from a prefab over time, that is assigned through a variable. I instantiate the prefab like so (Instantiation over time works fine)

            Transform t = spawnX; // Transform to hold the x position of the spawn point
            Vector3 v3 = t.position;
            v3.y = Random.Range(minHeight, maxHeight); // Random y position
            t.position = v3; // Get the random spawn point

            // Instantiate the prefab
            Instantiate(obstaclePrefab, v3, Quaternion.identity, t);

Again everything is working fine, except that when one instance is created, all already existing instances update their y-Position which was randomly created to the one of the new instance. Why is that?

You seem to parent the instance to the object transform “t” with your Instantiate call, so changing t will affect every children.