Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question cs1003 syntax error

Discussion in 'Scripting' started by JakePlayz122, Aug 10, 2023.

  1. JakePlayz122

    JakePlayz122

    Joined:
    Aug 10, 2023
    Posts:
    2
    hi I am having an issue while I am doing a unity tutorial is there anything wrong here that I could fix more specifically in the bottom lines upload_2023-8-10_13-20-24.png
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,561
    Correction: you're not having issues, you're just making typing mistakes. Now go fix them. 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?

    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.

    If you run into an actual problem as opposed to simply making typing mistakes that you can fix yourself, here is:

    How to report your problem productively in the Unity3D forums:

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

    This is the bare minimum of information to report:

    - what you want
    - what you tried
    - what you expected to happen
    - what actually happened, log output, variable values, and especially any errors you see
    - links to documentation you used to cross-check your work (CRITICAL!!!)

    The purpose of YOU providing links is to make our job easier, while simultaneously showing us that you actually put effort into the process. If you haven't put effort into finding the documentation, why should we bother putting effort into replying?

    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/
     
    JakePlayz122 and Ryiah like this.
  3. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,082
    Just to add on to this: a good code editor should show you where your errors are using red squiggly lines. If the editor you're using doesn't do that it's either not set up properly or it's not capable of it. Visual Studio Community and Rider will both do it out of the box.
     
    JakePlayz122 likes this.
  4. JakePlayz122

    JakePlayz122

    Joined:
    Aug 10, 2023
    Posts:
    2
    thank you that helped I did actually make a couple typing mistakes
     
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,561
    Good point... here's more reading for when (not if) it malfunctions, which it malfunctions a LOT:

    This may help you with intellisense and possibly other Visual Studio integration problems:

    Sometimes the fix is as simple as doing Assets -> Open C# Project from Unity. Other times it requires more.

    Other times it requires you also nuke the userprefs and .vsconfig and other crufty low-value high-hassle files that Visual Studio tends to slowly damage over time, then try the above trick.

    Barring all that, move on to other ideas:

    https://forum.unity.com/threads/intellisense-not-working-with-visual-studio-fix.836599/

    Also, try update the package inside of Unity: Window -> Package Manager -> Search for Visual Studio Editor -> Press the Update button

    Depending on flavor and version of Visual Studio, it may also have an installation step that you perform within the actual Visual Studio. This step seems finicky at best and may require multiple openings of VS before it comes up.

    Update: The VSCode extension has been deprecated and abandoned:

    https://forum.unity.com/threads/update-on-the-visual-studio-code-package.1302621/

    Update: the VSCode integration is back... maybe!?

    https://forum.unity.com/threads/microsoft-previews-unity-extension-for-visual-studio-code.1468913/

    There may be a community fork available that is receiving updates.

    https://github.com/Chizaruu/com.tsk.ide.vscode

    Also, this: https://forum.unity.com/threads/no-suggestions-in-vscode.955197/#post-6227874