Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Help with Camera Follow Script in cSharp

Discussion in 'Editor & General Support' started by TakesAunit, Nov 12, 2014.

  1. TakesAunit

    TakesAunit

    Joined:
    Nov 11, 2014
    Posts:
    3
    http://gyazo.com/4a921a91d162935d1af65fa220e296ff - Problem
    I am doing this video series to learn the basics of Unity, I have followed the "video instructions" exactally yet i always get these errors. Best thing yet my friends are doing the same thing i have copied their scripts same thing. I have literally copied and pasted theirs into mine and it still does this. I have watched this hour long video 4 times yet same thing. Please help me with this.

    using UnityEngine;
    using System.Collections;

    /// <summary>
    /// This Script is attached to the player and it causes the
    /// camera to follow the player.
    /// </summary>


    public class CameraScript : MonoBehaviour {


    //Variables Start______________________

    private Camera myCamera;

    private Transform cameraHeadTransform;

    //Variables End__________________________





    // Use this for initialization
    void Start () {
    myCamera = Camera.main;
    cameraHeadTransform = transform.FindChild ("Camera Head");


    // Update is called once per frame
    void Update ()
    {
    //Make the camera follow the player's cameraHead transform
    myCamera.transform.position = cameraHeadTransform.position;
    myCamera.transform.rotation = cameraHeadTransform.rotation;
    }
    }
     
  2. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Your Start() function doesn't have a closing brace.
     
  3. TakesAunit

    TakesAunit

    Joined:
    Nov 11, 2014
    Posts:
    3
    Wow. Thank you so much!