ProcessRotation() method not working

so I have all my code matching the lesson but then when I go to compile it, I receive this error in Unity:


Below is my code. Also, I don’t know why the code needs 3 braces at the end, but it won’t work without them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Movement : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        ProcessThrust();
    
        ProcessRotation();
    }

    void ProcessThrust()
    {
        if (Input.GetKey (KeyCode.W))
        {
            Debug.Log("W pressed, Thrusting");
        {
    }
    void ProcessRotation()
    {
        if (Input.GetKey (KeyCode.A))
        {
            Debug.Log("A pressed, rotating counterclockwise");
        }
        else if (Input.GetKey (KeyCode.D))
        {
            Debug.Log("D pressed, rotating clockwise");   
    
        }
    }

       
}}}

I hope I can get this to work right. it’s driving me crazy

Why 3 of these at the end? I’d guess removing the 2 extra ones and you’ll be good to go.

Oddly enough, if I remove even one of those I get a “} expected” error. I have no idea why it works that way but shrugs

ugh
fixed it by deleting it and rewriting the whole thing.

the triple brace thing went away too

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

Privacy & Terms