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

Working On Lesson One but having a scripting error

Discussion in 'Editor & General Support' started by LaVulpe, Feb 11, 2017.

  1. LaVulpe

    LaVulpe

    Joined:
    Feb 11, 2017
    Posts:
    3
    So I think I'm doing the tutorial right but every time I check Unity I see this
    Playercontroller.start cannot have a void type
    and a variety of other issues. I have included a screen shot of the issue as well as the source code. I'm very new to Unity. The only coding experience I have is with the Feralheart preset code but that was with Ogre.
    Script Error.PNG script.PNG
     
  2. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    519
    Your start function is missing a closing brace '}'.

    Also, the Unity events are 'Start()' and 'FixedUpdate()' with capitals.
     
  3. LaVulpe

    LaVulpe

    Joined:
    Feb 11, 2017
    Posts:
    3
    Thanks,
    I'm still curious if there's other things that I'm missing
     
  4. IronLionZion

    IronLionZion

    Joined:
    Dec 15, 2015
    Posts:
    78
    Also the brackets immediately following the function name should be these ( ), not these { }
     
  5. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    519
    Make those changes and find out :) Basic syntax errors will almost always cause other errors to appear because the compiler cannot make sense of your code. After you fix the first error the rest might be fixed too. If not then work your way through them in order.

    If you're going to continue to learn some coding in Unity I'd recommend getting a C# reference and learning some of the language by itself. Take note that Unity currently uses the older C# 4 and .Net 3.5 framework. eg. C# in a Nutshell or similar, or some other online reference.
     
  6. LaVulpe

    LaVulpe

    Joined:
    Feb 11, 2017
    Posts:
    3
    Thanks guys. I was working on this last night after work and I guess I must have made a syntax error. XD that's the last time I code while tired
     
  7. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    519
    No... no it's not :)