Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question Hello, i am getting error CS 1003 and CS1056 with this code

Discussion in 'Getting Started' started by hello06921, Sep 12, 2023.

  1. hello06921

    hello06921

    Joined:
    Sep 12, 2023
    Posts:
    2
  2. ijmmai

    ijmmai

    Joined:
    Jun 9, 2023
    Posts:
    188
    Hello, please post code as text between code tags.
    If you install the Unity extension for Visual Studio, your errors will easily be pointed out by the code editor itself.

    Use single quotes for text, not backticks, give your class properties and methods a private or public label
     
  3. BABIA_GameStudio

    BABIA_GameStudio

    Joined:
    Mar 31, 2020
    Posts:
    497
    It's pretty obvious to see that you have closed your class on line 18, so your entire Update method is outside of the class.
    Take the
    }
    from line 18 and put it on line 37 instead.
    Also:
    - Next time post your code in code tags, not as screenshots.
    - You are probably going to run into issues with your class as you should not be keeping it as NewBehaviourScript.
    - Fix your indentation, as at the moment it is rather awkward to see which
    {
    goes with which
    }
    .
    - When you want help with errors, tell us the whole error message(s) as the codes are the least important part of the entire error.