3DBuzz TP Camera ERRORS

The name `Helper’ does not exist in the current context

TP_Camera = TheCamera

TheCamera Script

using UnityEngine;
using System.Collections;

public class TheCamera : MonoBehaviour 
{
	public static TheCamera Instance;
	
	public Transform TargetLookAt;
	public float Distance = 5f;
	public float DistanceMin = 3f;
	public float DistanceMax = 10f;
	public float X_MouseSensitivity = 5f;
	public float Y_MouseSensitivity = 5f;
	public float MouseWheelMouseSensitivity = 5f;
	public float Y_MinLimit = -40f;
	public float Y_MaxLimit = 80f;



	
	
	private float mouseX = 0f;
	private float mouseY = 0f;
	private float startDistance = 0f;
	private float desiredDistance = 0f;
	
	
	void Awake() 
	{
		Instance = this;
	}

	void Start() 
	{
	 	Distance = Mathf.Clamp(Distance, DistanceMin, DistanceMax);
		startDistance = Distance;
		Reset();
	}
	

	void LateUpdate() 
	{
		if(TargetLookAt == null)
			return;
			
			HandlePlayerInput();
			
			CalculateDesiredPosition();
			
			UpdatePosition();
		
	}
	
	void HandlePlayerInput()
	{
		var deadZone = 0.1f;
		
		if(Input.GetMouseButton(1))
		{
			mouseX += Input.GetAxis("Mouse X") * X_MouseSensitivity;
			mouseY -= Input.GetAxis("Mouse Y") * Y_MouseSensitivity;
		}
		
		// This is where we will limit mouseY
		mouseY = Helper.ClampAngle(mouseY,Y_MinLimit,Y_MaxLimit);
		
		
		if(Input.GetAxis("Mouse ScrollWheel") < -deadZone || Input.GetAxis("Mouse ScrollWheel") > deadZone)
		{
			desiredDistance = Mathf.Clamp(Distance - Input.GetAxis("Mouse ScrollWheel") * MouseWheelMouseSensitivity, 
										  DistanceMin, DistanceMax);
		}
		
	}
	
	void CalculateDesiredPosition()
	{
		
	}
		
	void UpdatePosition()
	{
	
	}

	
	public void Reset()
	{
		mouseX = 0;
		mouseY = 10;
		Distance = startDistance;
		desiredDistance = Distance;
	}
	
	
	public static void UseExistingOrCreateNewMainCamera()
	{
		GameObject tempCamera;
		GameObject targetLookAt;
		TheCamera myCamera;
		
		if(Camera.mainCamera != null)
		{
			tempCamera = Camera.mainCamera.gameObject;
		}
		
		else
		{
			tempCamera = new GameObject("Main Camera");
			tempCamera.AddComponent("Camera");
			tempCamera.tag = "MainCamera";
		}
		
		tempCamera.AddComponent("TheCamera");
		myCamera = tempCamera.GetComponent("TheCamera") as TheCamera;
		
	
		
		targetLookAt = GameObject.Find("targetLookAt") as GameObject;
		
		
		if(targetLookAt == null)
		{
			targetLookAt = new GameObject("targetLookAt");
			targetLookAt.transform.position = Vector3.zero;
		}
		
		myCamera.TargetLookAt = targetLookAt.transform;
		
		
		
		
	}
}

Helper script

using UnityEngine;

public static class Helper
{
    public static float ClampAngle(float angle, float min, float max)
    {
        do
        {
            if (angle < -360)
                angle += 360;
            if (angle > 360)
                angle -= 360;
        } while (angle < -360 || angle > 360);

        return Mathf.Clamp(angle, min, max);
    }
}

What is wrong with it.

There’s no actual reference to helper.
Unity only knows you want to use a function called Helper, but has no idea what or where this ‘Helper’ is.

Also, the script file helper resides in is incomplete, try creating an empty script to see the structure and elements unity requires. (Mainly line 4 :wink: )