Having a compiler error with my PlayerController Code what is my issue?

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class PlayerController : MonoBehaviour

{

[SerializeField] float torqueAmout =1f;

Rigidbody2D rb2d;

// Start is called before the first frame update

void Start()

{

  rb2d = GetComponent<Rigidbody2D>();

}

// Update is called once per frame

void Update()

{

    if(Input.GetKey(KeyCode.LeftArrow));

    {

        rb2d.AddTorque(torqueAmout)

    }

}

}

Hi John,

Welcome to our community! :slight_smile:

What error do you get?

Also remove the semicolon behind the parentheses of the if-statement in the Update method. Remember you can also look at the lecture code changes via the link in the Resources of each lecture.


See also:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms