Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development

more errors how do I fix this

c:\Users\thegreatdp\Documents\unity games\frogs and logs\Assets\Scripts\FollowCamera.cs(9,9): Error CS1518: Expected class, delegate, enum, interface, or struct (CS1518) (Assembly-CSharp). c:\Users\thegreatdp\Documents\unity games\frogs and logs\Assets\Scripts\FollowCamera.cs(9,9): Error CS1518: Expected class, delegate, enum, interface, or struct (CS1518) (Assembly-CSharp). c:\Users\thegreatdp\Documents\unity games\frogs and logs\Assets\Scripts\FollowCamera.cs(9,9): Error CS1518: Expected class, delegate, enum, interface, or struct (CS1518) (Assembly-CSharp) using UnityEngine; using System.Collections;

[SerializeField] private Transform player; private Vector3 offset; private float cameraFollowSpeed = <5f;

public class FollowCamera : MonoBehaviour {

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    Vector3 newPosition = player.position + offset);
    transform.position = Vector3.Lerp(transform.position, newPosition, cameraFollowSpeed*Time.deltatime);
}

}

2 Answers

Hi,

That's a little hard to read due to the way that the markdown is displaying your code. I haven't watched the video yet but I think it may be to do with the line:

[SerializeField] private Transform player; private Vector3 offset; private float cameraFollowSpeed =

Is that supposed to be an = on the end or should it be a ; and secondly should the line be inside of the class rather than before it?

Thai Huynh
Thai Huynh
15,293 Points

Hi try changing deltatime to deltaTime.