Search Unity

CS0501 Must declare a body

Discussion in 'Scripting' started by AdamMCE, Jun 18, 2021.

  1. AdamMCE

    AdamMCE

    Joined:
    May 3, 2021
    Posts:
    18
    After scouring google, I can't find a fix for this. I'm just making a super simple function, but for some reason it's reading back an error saying I need to "declare a body because it is not marked abstract, extern, or partial" which I have no idea what this means, even after googling and visiting many pages.

    Code (CSharp):
    1. public void MoveSelect();
    That's all the code says so far. I assumed declaring a body was just inserting the "{}" underneath the function, but this didn't do anything and just returned many many more errors. I don't understand what I'm doing wrong here, as I've written many functions already like this within the script. Any help?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    Remove the semicolon. This isn't K&R C. :)
     
    AdamMCE likes this.
  3. AdamMCE

    AdamMCE

    Joined:
    May 3, 2021
    Posts:
    18
    OH MY GOD hahaha, such a simple mistake. Thank you :)