Search Unity

Help im getting the error Assets/camerFollow.cs(9,4): error CS1525: Unexpected symbol `public'

Discussion in 'Scripting' started by unity_JBxxYbvWifceFA, Oct 3, 2018.

  1. unity_JBxxYbvWifceFA

    unity_JBxxYbvWifceFA

    Joined:
    Oct 3, 2018
    Posts:
    2
    I'm extremely new to unity and I'm trying to get a simple camera follow script on my character but it keeps bring up this error. And I know camera is spelt wrong.

    using UnityEngine;

    public class camerFollow : MonoBehaviour {

    public Transform target;

    public float smoothSpeed = 1.25f
    public Vector3 offset;


    void LateUpdate ()
    {
    Vector3 desiredPosition = target.position + offset;
    Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed);
    transform.position = smoothedPosition;

    transform.LookAt(target);
    }
    }
     
  2. MSplitz-PsychoK

    MSplitz-PsychoK

    Joined:
    May 16, 2015
    Posts:
    1,278
    You need a semi-colon after "public float smoothSpeed = 1.25f".

    Forgetting a semi-colon usually throws an error for the next line, rather than the line missing the semi-colon.
     
    Joe-Censored likes this.
  3. unity_JBxxYbvWifceFA

    unity_JBxxYbvWifceFA

    Joined:
    Oct 3, 2018
    Posts:
    2
    Thank you, I'm not a very observant person but I did end up noticing the semicolon, thanks for explaining