why the camera get wrong after build the game

i was making a game. And i wanted to build yesterday.
That is all right in the unity. But after i build , the camera did not follow my object.
using UnityEngine;
using System.Collections;

public class ThirdPersonCamera : MonoBehaviour
	public float smooth = 3f;		// a public variable to adjust smoothing of camera motion
	Transform standardPos;			// the usual position for the camera, specified by a transform in the game
	Transform lookAtPos;			// the position to move the camera to when using head look
	void Start()
		// initialising references
		standardPos = GameObject.Find ("CamPos").transform;
		if(GameObject.Find ("LookAtPos"))
			lookAtPos = GameObject.Find ("LookAtPos").transform;
	void FixedUpdate ()
		// if we hold Alt
		if(Input.GetButton("Fire2") && lookAtPos)
			// lerp the camera position to the look at position, and lerp its forward direction to match 
			transform.position = Vector3.Lerp(transform.position, lookAtPos.position, Time.deltaTime * smooth);
			transform.forward = Vector3.Lerp(transform.forward, lookAtPos.forward, Time.deltaTime * smooth);
			// return the camera to standard position and direction
			transform.position = Vector3.Lerp(transform.position, standardPos.position, Time.deltaTime * smooth);	
			transform.forward = Vector3.Lerp(transform.forward, standardPos.forward, Time.deltaTime * smooth);

what’s wrong?
i set this script to main camera and there is no any other child.
sorry for poor english.

I had the exact same problem, but solved it just now.

I based my game on the same scripts you’re using, but I found that there was 2 different scripts with the name “ThirdPersonCamera” in my project. One of them was C# while the other one was JavaScript. I think this is what screws it up after build.

Search for “ThirdPersonCamera” in your assets, and delete the ones you don’t use. For me this was the JavaScript file.

After deleting this “duplicate”, everything works just fine. Hope this works for you too! :slight_smile: