Search Unity

Problem With My Character Generator in Unity (c#/ Monodevelop)

Discussion in 'Scripting' started by Halorvb13, Aug 1, 2014.

  1. Halorvb13

    Halorvb13

    Joined:
    Aug 1, 2014
    Posts:
    2
    So I've been attempting to teach myself some c# through Youtube tutorials, and is going pretty well. Until I came across this in my CharacterGenerator. It keeps telling me that I have these two errors:
    1.CharacterGenerator.cs(20,27): error CS1547: Keyword 'void' cannot be used in this context
    2. CharacterGenerator.cs(20,28: error CS1525: Unexpected Symbol '(', expecting ')', ',', ';', '[', or '='
    But I can't figure out what the error actually is/ how to fix it. On top of that whenever I try to attach my code to the main camera, it says:
    "Can't add script
    Can't add component 'CharacterGenerator' because it does not exist.Check to see if file name and class name match."

    It says that with all my scripts. Is that just because of my current errors with this script?
    Below is my script for the CharacterGenerator:
     

    Attached Files:

  2. lrlelaldl

    lrlelaldl

    Joined:
    Jul 27, 2014
    Posts:
    75
    Posting your code in a code box rather than having us download your code would allow for easier help.

    About your script not existing you need to make sure that the name of th class in the file is the same as the filename, exactly the same ,so even spaces and capitalisation needs to be exactly the same
     
  3. Halorvb13

    Halorvb13

    Joined:
    Aug 1, 2014
    Posts:
    2
    Yeah, I got it to work. Part of the problem was that I didn't have an end bracket for my start function, which is why those errors were there, and once I fixed that. I was able to add the code to my camera, and it all works. It was such a stupid error.