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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

It's saying "...ller.cs(12,76): error CS1009: Unrecognized escape sequence `\" ... ?

Discussion in 'Editor & General Support' started by Brian-Washechek, Oct 1, 2018.

  1. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    " Assets/Scripts/PlayerControlller.cs(12,76): error CS1009: Unrecognized escape sequence `\ " is the error it hits me with. It didn't used to, This error is new for today. 9-30-2018.png There is nothing I see wrong with the code, so it seems. But it appears that I'm wrong. That's why I'm here. I'm hoping someone more knowledgeable on this forum can see .
     
    Last edited: Oct 1, 2018
  2. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    Here is the code.
     
  3. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    I downloaded it and tried to run the way you guys would and got a different error:

    There are inconsistent line endings in the 'Assets/Scripts/PlayerControlller.cs' script. Some are Mac OS X (UNIX) and some are Windows.
    This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.


    10-1-2018.png

    I have no idea what that means. Perhaps someone here does
     
    Last edited: Oct 1, 2018
  4. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,335
    Just by-the-way: the easiest way to share code on the forum is to use the "Insert Code" button, and then paste your code in the pop-editor that appears.

    This error does not really make any sense (The first error that you were talking about), but maybe there is some weird, invalid white-space character in your code file. There is some menu option in Visual Studio that lets you visualize white space.

    As for your next post, the inconsistent line ending message is not usually a problem, but there should also be a menu option in VS to "fix line endings" somewhere. It's been a while since I've used VS.

    Edit: to elaborate further- this is one of the dangers of copy-pasting code. Sometimes the source will contain weird formatting characters that you can't really see, but the compiler does not recognize. Things like non-breaking space instead of a regular space, or special UTF-8 double quotes instead of regular double quotes.
     
    Last edited: Oct 1, 2018
  5. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    Code (CSharp):
    1. // Sorry, I'll change my ways.
    And I found the link you were talking about here.

    Clearing how my code looks didn't really catch errors. It says I'm missing assemble reference. I think that's my problem. Does that help you hep me?
     
    Last edited: Oct 1, 2018
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Your first screenshot shows that you haven't saved yet in Visual Studio (the filename has a * after it). This would make sense since what you are showing in the Editor has an extra \ character, so the error is correct.
     
  7. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,335
    That's a separate issue. In your screenshot the rest of the error message is cut-off, but is it complaining about "rigidbody" by any chance? There used to be a member in Monobehaviour called "rigidbody" but it was removed at some point. Now you have to get a reference to the rigidbody component using GetComponent.