Help needed

I have tried to run this code:

using UnityEngine;
public class Cube : MonoBehaviour
{
void Update()
{
if (Input.GetKeyDown (KeyCode.D))
GetComponent():AddTorque(0, 5, 0);
else if (Input.GetKeyDown (KeyCode.I))
GetComponent():AddTorque(0, -5, 0);
}
}

but it won´t work because it has an error:

Assets\Scripts\Cube.cs(9,38): error CS1513: } expected

thanks if someone helps

Instead of:
GetComponent<Rigidbody>():AddTorque
it should be:
GetComponent<Rigidbody>().AddTorque

(replaced : with .)

1 Like

also for your sanity and especially ours learn to post your code with code tags…

1 Like