(18,44) error CS1003: sintax error ',' expected and (18.45) error CS1002 ; expected

I’m VERY new to Unity and made this code semi by myself, what’s the issue? btw i’m trying to make the player (capsule) rotate, which is where the problem is.

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

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

    // Update is called once per frame
    void Update()
    {
        //BASIC ahh wasd
        if (Input.GetKey(KeyCode.A))
        {
            transform.position += new Vector3(0.2f, 0, 0);
        }

        if (Input.GetKey(KeyCode.D))
        {
            transform.position += new Vector3(-0.2f, 0, 0);
        }

        if (Input.GetKey(KeyCode.W))
        {
            transform.position += new Vector3(0, 0, -0.2f);
        }

        if (Input.GetKey(KeyCode.S))
        {
            transform.position += new Vector3(0, 0, 0.2f);
        }
        //BASIC ahh wasd

        if (Input.GetKey(KeyCode.Q))
        {
            transform.rotation* Quaternion.Euler(0, transform.rotation.y + 1, 0);
        }

    }
}

(also idc too much if it works, i just want to fix the errors)

transform.rotation* Quaternion.Euler(0, transform.rotation.y + 1, 0); is not a valid syntax

What are you using to type your code?

Andrew has pinpointed the error and sacbOy asks a very good question. Having a decent code editor would have identified the line "as you were typing it". This type of problem is also a very good one for you to experiment with solving. Missing commas and semicolons are easy compared to what you will eventually encounter.

bruh this was like a year ago i dont remember

1 Answer

1

You can fix your own typing mistakes. Here’s how:

Remember: NOBODY here memorizes error codes. That’s not a thing. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.

The complete error message contains everything you need to know to fix the error yourself.

The important parts of the error message are:

  • the description of the error itself (google this; you are NEVER the first one!)
  • the file it occurred in (critical!)
  • the line number and character position (the two numbers in parentheses)
  • also possibly useful is the stack trace (all the lines of text in the lower console window)

Always start with the FIRST error in the console window, as sometimes that error causes or compounds some or all of the subsequent errors. Often the error will be immediately prior to the indicated line, so make sure to check there as well.

Look in the documentation. Every API you attempt to use is probably documented somewhere. Are you using it correctly? Are you spelling it correctly? Are you structuring the syntax correctly? Look for examples!

All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don’t have to stop your progress and fiddle around with the forum.