Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

(plis help me) compiller error (25,40): error CS1003: Syntax error, ',' expected

Discussion in 'Getting Started' started by nachoamso, May 18, 2024.

  1. nachoamso

    nachoamso

    Joined:
    May 18, 2024
    Posts:
    1
    (plis help me) compiller error (25,40): error CS1003: Syntax error, ',' expected

    here´s my code:
    bool choque = false;
    private void OnCollisionEnter2D(Collision2D other)
    {
    if(other.collider.CompareTag("bloque"))
    {
    choque = true ;
    }
    }
    // Start is called before the first frame update
    void Start()
    {

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

    //mover
    OnCollisionEnter2D(Collision2D other);
     
  2. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    2,166
    well
    Code (CSharp):
    1. OnCollisionEnter2D(Collision2D other);
    2.  
    makes no sense inside update... please next time use code tags
     
    Bunny83 likes this.
  3. HajiyevEl

    HajiyevEl

    Joined:
    Feb 19, 2020
    Posts:
    55
    Paste all code, preferentially inside code block
    Code (CSharp):
    1.  // to make code block - paste your code inside [code=CSharp] your code [/сode]
     
    Bunny83 likes this.
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,345
    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.



    For future reference when you have an actual issue:

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

    How to use code tags: https://forum.unity.com/threads/using-code-tags-properly.143875/