parallax on x, But how on the y as well? [Solved]

Hi.

I’ve made a script and it works. But my problem is that it only “scrolls?” on the x. And my question is, how do I need to make it so that it also gives this effect on the y?

using UnityEngine;
using System.Collections;

public class Paralaxing : MonoBehaviour {

	public Transform[] Backgrounds;				//Array of background and forground
	private float[] ParallaxScales;
	public float Smoothing = 1f;						//Minimal 1

	private Transform cam;
	private Vector3 PreCamPo;

	void Awake(){
		cam = Camera.main.transform;
	}

	// Use this for initialization
	void Start () {
		PreCamPo = cam.position;

		ParallaxScales = new float[Backgrounds.Length];

		for (int i = 0; i < Backgrounds.Length; i++) {
			ParallaxScales  <em>= Backgrounds _.position.z * -1;_</em>

* }*
* }*

* // Update is called once per frame*
* void Update () {*

* for (int i = 0; i < Backgrounds.Length; i++) {*
_ float parallax = (PreCamPo.x - cam.position.x) * ParallaxScales ;_

_ float BackgroundTargetPosX = Backgrounds .position.x + parallax;_

Vector3 BackgroundTargetPos = new Vector3 (BackgroundTargetPosX, Backgrounds .position.y, Backgrounds .position.z);

Backgrounds .position = Vector3.Lerp (Backgrounds .position, BackgroundTargetPos, Smoothing * Time.deltaTime);

* }*

* PreCamPo = cam.position;*
* }*
}

Hope it is an easy fix. Thanks.
-coasterMind
Script is halv copied from Brackeys.

Probably you just have to mirror the code in Update() that does the effect for x:

void Update () {
 
         for (int i = 0; i < Backgrounds.Length; i++) {
             float parallax = (PreCamPo.x - cam.position.x) * ParallaxScales *;*

float BackgroundTargetPosX = Backgrounds .position.x + parallax;

Vector3 BackgroundTargetPos = new Vector3 (BackgroundTargetPosX, Backgrounds .position.y, Backgrounds .position.z);

Backgrounds .position = Vector3.Lerp (Backgrounds .position, BackgroundTargetPos, Smoothing * Time.deltaTime);

}
Copy everything that is specific to x and use it again for y.
void Update () {

for (int i = 0; i < Backgrounds.Length; i++) {
float parallax_x = (PreCamPo.x - cam.position.x) * ParallaxScales ;
float parallax_y = (PreCamPo.y - cam.position.y) * ParallaxScales ;

float BackgroundTargetPosX = Backgrounds .position.x + parallax_x;
float BackgroundTargetPosY = Backgrounds .position.y + parallax_y;

Vector3 BackgroundTargetPos = new Vector3 (BackgroundTargetPosX, BackgroundTargetPosY, Backgrounds .position.z);

Backgrounds .position = Vector3.Lerp (Backgrounds .position, BackgroundTargetPos, Smoothing * Time.deltaTime);

}