c# parsin error

Hey. I get a parsing error with this script.

using UnityEngine;

public class cameraFollow(){

	public float LockedZ = 0;
	public GameObject player;
	void Update(){
		transform.position = new Vector3(player.transform.x, LockedZ);	

can you guys help me?

If that script is a copy-paste of what you have than I’d look at your class declaration.

Assuming you’re using C#

this: public class cameraFollow(){...}

should be this: public class cameraFollow : MonoBehaviour{...}

or if you don’t want to inherit from MonoBehaviour it would be: public class cameraFollow{...}

try that.

and @ save. While I agree that if you’re initializing a Vector3 you should use x,y,z… it is a vector3 after all. However, there is an overload for a V3 constructor that takes just x and y.

.- Raph -