Assets\MouseLook.cs(29,62): error CS1003: Syntax error, ',' expected

Im new to unity and I used this script and this error poped up

Assets\MouseLook.cs(29,62): error CS1003: Syntax error, ‘,’ expected

This is my script

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

public class MouseLook : MonoBehaviour
{

    public float mouseSensitivity = 100f;

    public Transform playerBody;

    float xRotation = 0f;
   
    // Start is called before the first frame update
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
    }

    // Update is called once per frame
    void Update()
    {
        float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
        float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;

        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);

        transform.localRotation = Quaternion.Euler(xRotation 0f, 0f);
        playerBody.Rotate(Vector3.up * mouseX);
    }
}

If anyone can help me please

You see the error? You see the line number 29? Do you see anything missing in line 29, like maybe a comma the way that the error message tells you?

1 Like

Also, what is with the duplicate posts?! Just edit your previous post, the one I already responded to.

1 Like

on im sorry im new I diden’t know I could edit it

I added a comma after xRotation (is it supposed to go there) and it responded with this error

Assets\MouseLook.cs(12,22): error CS1001: Identifier expected

in line 29 it is.

did you add a comma also in line 12? because that’s not a thing, that does not make sense.

look, rather than me playing remote one-character-at-a-time proofreader, just go back and get 100% of the spelling, capitalization and punctuation just right from wherever you got this. 100% of it has to be correct for any of it to work.

Errors are there to help you. It’s a good idea to try and learn how to understand them. Try to apply the breakdown in this post of your original error to the new error you’re receiving. If you don’t understand a word, don’t just gloss over it. Ask what the word means here, or research it elsewhere. Cultivating a habit of research will pay dividends for you in every part of your coding journey.

Here’s a breakdown of your specific error, but try applying this process to any other error you may encounter as well:

This section of the error is the prefix, and the format is standard across all messages:

Assets\MouseLook.cs(29,62) → The compiler encountered an error at this file: Assets\MouseLook.cs, at this position (line, column): (29,62)

error CS1003 → A technical code that refers to this specific type of error. When in doubt, try googling the code in question (eg. “c# CS1003” or “unity CS1003”). It will probably lead you to a page like this ( CS1003), which will provide more context for what the error is and why it occurs. This is a great last resort when trying to figure out why an error is happening. It will also often lead you to a helpful StackOverflow post, or even right back to this forum .

The rest of the error is the error message itself:

The error message varies wildly from error to error. For many common errors you will be able to copy paste this section directly into a search engine and find many articles/forum posts/etc. on what it means and why it happens.

Syntax error → something is wrong with how the code is formatted.

',' expected → The compiler was expecting a comma at this location but didn’t find one.

All of the above boils down to this:

On line 29, you forgot a comma between xRotation and 0f:

transform.localRotation = Quaternion.Euler(xRotation 0f, 0f);
9 Likes

This was so well put I am going to keep a link to the above post just for times like this.

LMK if that bugs you in any way and I won’t post your link, otherwise, it’s in the hopper!

“Get to the hoppah!”

3 Likes

Help please.

I was scripting when i found this error:error CS1519: Invalid token ‘=’ in class, struct, or interface member declaration

thise is the script :confused:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class visuale : MonoBehaviour
{
public Transform player;
float sensibilità = 300f;
float rotazione;

// Start is called before the first frame update
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
} Cursor.visible = false
// Update is called once per frame
void Update()
{
float x = Input.GetAxis(“Mouse X”) * Time.deltaTime * sensibilità;
float y = Input.GetAxis(“Mouse Y”) * Time.deltaTime * sensibilità;
rotazione -= y;
rotazione = Mathf.Clamp(rotazione, -60f, 60f);
transform.localRotation = Quaternion.Euler(rotazione, 0, 0);
player.Rotate(Vector3.up * x);
}
}

I need help please.

Do not hijack other people’s threads for your problems. It’s against forum rules.

Start your own post. It’s FREE!

Remember: NOBODY memorizes error codes. 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 important parts of an 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)

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.

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

How to understand compiler and other errors and even fix them yourself:

https://discussions.unity.com/t/824586/8

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: https://discussions.unity.com/t/481379

1 Like

Please start your own thread.

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

How to understand compiler and other errors and even fix them yourself:

https://discussions.unity.com/t/824586/8

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: https://discussions.unity.com/t/481379

Use code tags:
https://www.youtube.com/watch?v=84kaypWK1bM

hi i have error (Assets\look.cs(29,62): error CS1003: Syntax error, ‘,’ expected)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class look : MonoBehaviour
{
public float mouseSensitivity = 100f;
public Transform human;
float xRotation = 0f;
// Start is called before the first frame update
void Start()
{
cursor.lockstate = cursorlockmode.locked;
}
// Update is called once per frame
void Update()
{
float mouseX = Input.GetAxis(“Mouse X”) * mouseSensitivity * Time.deltaTime;
float mouseY = Input.GetAxis(“Mouse Y”) * mouseSensitivity * Time.deltaTime;
xRotation -= mouseY;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
transform.localRotation = Quaternion.Euler(xRotation 0f, 0f);
human.Rotate(Vector3.up * mouseX);
}
}

Please STOP necroposting.

You are just making fatfinger typos here. You can fix them yourself, here is how:

Remember: NOBODY memorizes error codes. 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.

Always start with the FIRST error in the console window, as sometimes that error causes or compounds some or all of the subsequent errors.

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)

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.

How to do tutorials properly:

Tutorials are a GREAT idea. Tutorials should be used this way:

Step 1. Follow the tutorial and do every single step of the tutorial 100% precisely the way it is shown. Even the slightest deviation (even a single character!) generally ends in disaster. That’s how software engineering works. Every single letter must be spelled, capitalized, punctuated and spaced (or not spaced) properly. Fortunately this is the easiest part to get right. Be a robot. Don’t make any mistakes. BE PERFECT IN EVERYTHING YOU DO HERE.

If you get any errors, learn how to read the error code and fix it. Google is your friend here. Do NOT continue until you fix the error. The error will probably be somewhere near the parenthesis numbers (line and character position) in the file. It is almost CERTAINLY your typo causing the error, so look again and fix it.

Step 2. Go back and work through every part of the tutorial again, and this time explain it to your doggie. See how I am doing that in my avatar picture? If you have no dog, explain it to your house plant. If you are unable to explain any part of it, STOP. DO NOT PROCEED. Now go learn how that part works. Read the documentation on the functions involved. Go back to the tutorial and try to figure out WHY they did that. This is the part that takes a LOT of time when you are new. It might take days or weeks to work through a single 5-minute tutorial. Stick with it. You will learn.

Step 2 is the part everybody seems to miss. Without Step 2 you are simply a code-typing monkey and outside of the specific tutorial you did, you will be completely lost.

Of course, all this presupposes no errors in the tutorial. For certain tutorial makers (like Unity, Brackeys, Imphenzia, Sebastian Lague) this is usually the case. For some other less-well-known content creators, this is less true. Read the comments on the video: did anyone have issues like you did? If there’s an error, you will NEVER be the first guy to find it.

Beyond that, Step 3, 4, 5 and 6 become easy because you already understand!

what do i do about this?

transform.Rotate(0f, PlayerMouseInput.x, * MouseSensitivity 0f);

and the error says:
Assets\scripts\playermovement.cs(49,68): error CS1003: Syntax error, ‘,’ expected

Same thing: PLEASE … stop necro posting and stop making typos. You have left out a character. It’s pretty friggin’ obvious which one. Go back to where you got this.

Since you clearly completely and totally failed to read this thread before plunking your necro post down, I’ll post it again for you.

Tutorials and example code are great, but keep this in mind to maximize your success and minimize your frustration:

How to do tutorials properly, two (2) simple steps to success:

Step 1. Follow the tutorial and do every single step of the tutorial 100% precisely the way it is shown. Even the slightest deviation (even a single character!) generally ends in disaster. That’s how software engineering works. Every step must be taken, every single letter must be spelled, capitalized, punctuated and spaced (or not spaced) properly, literally NOTHING can be omitted or skipped.
Fortunately this is the easiest part to get right: Be a robot. Don’t make any mistakes.
BE PERFECT IN EVERYTHING YOU DO HERE!!

If you get any errors, learn how to read the error code and fix your error. Google is your friend here. Do NOT continue until you fix your error. Your error will probably be somewhere near the parenthesis numbers (line and character position) in the file. It is almost CERTAINLY your typo causing the error, so look again and fix it.

Step 2. Go back and work through every part of the tutorial again, and this time explain it to your doggie. See how I am doing that in my avatar picture? If you have no dog, explain it to your house plant. If you are unable to explain any part of it, STOP. DO NOT PROCEED. Now go learn how that part works. Read the documentation on the functions involved. Go back to the tutorial and try to figure out WHY they did that. This is the part that takes a LOT of time when you are new. It might take days or weeks to work through a single 5-minute tutorial. Stick with it. You will learn.

Step 2 is the part everybody seems to miss. Without Step 2 you are simply a code-typing monkey and outside of the specific tutorial you did, you will be completely lost. If you want to learn, you MUST do Step 2.

Of course, all this presupposes no errors in the tutorial. For certain tutorial makers (like Unity, Brackeys, Imphenzia, Sebastian Lague) this is usually the case. For some other less-well-known content creators, this is less true. Read the comments on the video: did anyone have issues like you did? If there’s an error, you will NEVER be the first guy to find it.

Beyond that, Step 3, 4, 5 and 6 become easy because you already understand!

thank you @Kurt-Dekker for stoping people from hijacking other threads

Guys he is trolling 100%

And like that, your post is a good reason to lock this thread.

1 Like