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

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
Movement programming
so i am getting this error and i cant figure out whats the problem (20,21): error CS1002: ; expected
NavMesh agent is getting roated -180 on x value, need help.
no x movement in the air (while jumping)
How would you change this to work for an Enemy npc
Assets\Characters\PlayerMovement.cs(33,54): error CS1001: Identifier expected
Why it doesn't work (829428)
hi i am Programming with c#. I have an errorand i don´t know how to fix it. Please help !
help on ground check
error CS1061: 'List<GameObject>' does not contain a definition
moving object help
Change de inputfield value qith script
Drawing free lines is displaced on 34" monitor
Help (827818)
ERROR CS1513 :} EXPECTED
Can't change transform of an object, called from another object(script)
How to get the position of an object from another script and force the object to move to the resulti
Buttons not working (830451)
Input Key to Accelerate Player
'Chunk' does not contain a constructor that takes 2 arguments
HOW TO FIX IK PROBLEM (HELP WANTED)
HOW TO FIX .... IS INACCESSIBLE DUE TO ITS PROTECTION LEVEL
How to make management on Android
(Noob question) Error CS1003: Syntax error ',' expected
cannot convert from 'UnityEngine.Collision' to 'UnityEngine.Rigidbody'
Target Killing
I need help with MainMenu
Se requiere una referencia de objeto para el campo, método o propiedad 'Sistemadepuntos.Partida.punt
The script don't inherit a native class that can manage a script. (844025)
New to Unity and require some assistance
Many errors CS0246, CS0117
Unity 2019.2.21 to 2021.1 error. Need help upgrading
"How to fix ""Error CS1022: Type or namespace definition, or end-of-file expected""" (839080)
Syntax Error - I don't have a license
Camera not rotating inside IF statement
Problem (825113)
How to know the force on a rigidbody 2d?
Having Difficulty With 3D Movement Script on New Project (Beginner User)
Different Menus
Error: Non-invocable member 'CameraManager.cameras' cannot be used like a method.
Error CS1010
Need help (837524)
Mining system on Unity C#
Hey Guys Can U Help Me?
Help! (830530)
Problem with my script lines, cant solve the error.
cs1002 error how do i fix?
Error csharp
error CS1513 AND CS1002
Im New and had a CS0246 Question.
Scripting Error (829607)
I bet, these errors shouldn't be here. Help.
Button.OnClick() is not evoked
Numerous errors? I followed a tutorial but it seems to not work for me
How can I swap any card from above to any card from the bottom?
Error #CS0116 (New C# and Game Dev Question)
Error CS1003 Syntax error "{" expected
UNITY 4.0 C# ISSUE WITH I THINK GRAVITY OR SOMETHINGS LIKE IT
Thing being dumb and pretty much saying everything is the problem
Error CS0111 (not a bug)
How to Change color to 4 object and move up and down more object at the same time
I keep getting error code CS1001
Script Moving Problems
I got this invalid token error and I don't know how to fix it.
need help with error cs0246
How can I make a trigger in 2d
Endless Runner game-Sprites with Unlit/Transparent shader dont appear in the game mode
(SOLVED)
i have there errors can u help?
So I just started learning and I need some help
Help with this box
i take this script from youtube and he take me to some position when i click how to change it
Assets\Tests\NewBehaviourScript.cs(28,43): error CS1002: ; expected
I am using a book to learn unity, and there is some GUI code that doesn't seem to be working.
Trouble making my character run instead of walk
Identifier expected error (826584)
NullReferenceException: Object reference not set to an instance of an object CameraOrbit.LateUpdate
I have a code by idk how connect it to the fbx model from blender (839059)
Im getting error cs0115
Acceleration in Character Scripts
Cannot implicitly convert type string to bool. PLEASE HELP!!!
how do i fix this health bar?
Help with the code (826905)
Is there anything wrong with this script?
Error CS1061 (847258)
Error (853653)
Difficulty (Easy Normal Hard) script that increases AI attacks
why is jumping not working please help
The character only picks up one item
Defeat a enemy and victory message to appear, with trouble
Error CS0246 (843867)
Help! ( error CS1003: Syntax error, ',' expected
Hello, I have come to ask for help with this script that causes me a problem because it has the erro
Unity Code Help
Who can help me solve my problem?
Hello I need help to solve this script I do not know how to solve it because it tells me that it has (839052)
Save and load system not working
Why does killing the zombie break the music? And how do I fix this?
How to change the value of ToggleGroup to a string? And how to pass Togglegroup values to WWWFrom?
Can't Get This Code To Work
Muzzle Flash is not working Plz help
Snap to grid (829084)
I want the bullet to shoot at the center of the screen
Problems with FPS camera.
Can somebody help me with jump script?
How to fix these FirstPersonController Standard Assets errors?
Unity 2019.4.23f1 Broke Prefabs and Project - NullReferenceException, ArgumentNullException
Taking key with button
Hello I need help to solve this script I do not know how to solve it because it tells me that it has (844798)
Jump (846513)
day night cycle
Hi! I have a little problem with ''food spawner" for snake.
script with an error.
Can't make my player movement stop after release button
Looking and moving
Error expected } (832760)
Problem with moving Character Controller (translation of keyboard control to buttons).
cant find the problem
ScriptableObject array
How to use "is not null" in unity?
Assets\Scripts\PlayerController.cs(34,57): error CS1003: Syntax error, ',' expected
Change direction of an object 2d
Simple coding issue I am not equipped for. Please Help!
Sorry but why this script didn't working?
I do not know where the error! Could you help me to check the two scripts, please?
Script errors (828688)
Help converting this ini to a string.
Errors when compiling the project
Jump Script (845933)
Error CS2015, please help!
I need Help I don't Know why this is not working im new to Unity So i may be under looking something
problems with my fps controller
Mouse script dont working
When object A hits object B number go down
how to fix this code error plzzz
C0246 error
translation of cube
Unity Stops working...after i clicked play button and and spawner scripts active
Help with syntax!
How Can I fix this?
Trying to destroy enemy ship piece by piece
I want to enable PlayerPrefs to the text so it display the last silder value on Start
I'm having problems with setting up a multiplayer mode
How do I change tiles on a tilemap based on a two dimensional integer array?
NullReferenceException (834677)
Help required, error CS0131
Many errors
when i type simple code such as Debug.Log("hello "); it says too many characters in character liter
Assets\angle\Script\outvolt.cs(10,9): error CS0102: The type 'outvolt' already contains a definition
Scripts for a Pooltable [udon] not working. Monobehaviour issue +
Error CS1022 Type or namespace definition, or end-of-file expected can you tell what's wrong?
Error CS1513: } expected (825474)
Help (892573)
Rotation continuing after key lifted
Assets\Player Look.cs(24,22): error CS1002: ; expected
Jump to start of IF-Statement
My code has no errors but it does not work.
Error CS1061 (840530)
Whats Wrong With My Code?
I need help it keeps on saying The name 'i' does not exist in the current context on line 19 21. (835035)
Non-invocable member 'Teleport' cannot be used like a method.
I have a problem (835319)
I can't play my game
A bug with my terrain generator
Timer help (842469)
unity error cs1002 ; expected
I'm getting this error: the modifier public is not valid for this item
using System.Collections; using System.Collections.Generic; using UnityEngine; public class DroneMo
transform of a gameobject
Code error (827652)
"Syntax error, ',' expected" (828423)
How do I make my code work?
Script not working (839056)
C# Health and Damage Script help needed
error cs1002 expected
SceneMangement compiling errors
CS1002 (25,31) pls help
Why cant my script work?
how to norlmalize rotation if the plane reach the direction
I have error cs0501
I want to connect float to text mash pro
Script error (834339)
Clicker. Doubling the purchase price

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