Is something wrong with my Unity? I'm new :P

Ok, so every time I watch a tutorial on unity from youtube, I do it exactly as they do it, but end up getting errors. Nobody else seems to in the comments. And when I copy a script word by word on youtube or a script online, I always end up getting errors. This can be really irritating, since it’s just me who is experiencing errors.


Ok, here is a totally different discussion. This is a separate question.

I tried doing this script on my own and not copying it from somewhere else, but I got an error CS1519 and CS1525, which are unexpected symbols.

Help? :3

there are so many syntax errors o.O Not sure if you trolling.

  1. two { after the class line
  2. no ; after Application.LoadLevel(1)
  3. put the { which is above the second if condition below it (and above the })

You should learn the fundamentals of C# before trying to use unity.

You’re not doing it exactly as they do it. It really does need to be exact, not kinda sorta “close enough”; every last character counts in programming. Maybe you’d be better off with text tutorials.

–Eric

1 Like

I’m not trolling. This is why I don’t script myself :stuck_out_tongue: but thanks!

I kept looking at the video to see if I did it right. Like, sometimes their text is orange and mine is pink. I dunno what that means.

maybe because they use a different tool for programming or just have a different syntax highlighting…

you should know two things for now when programming:
there are statements and logical blocks.

  • Statement: Ends always with a semicolon ;

  • Assignments: int x = 42;

  • Calls: DoSomething();

  • Loigical Block: has some definition on the top and and a block below { }

  • Class definition: public class MyClass { }

  • Method definition: public void DoSomething() { }

  • If Condition: if(something == true) { } else { }

  • Loops: foreach(var element in myCollection) { }

  • some more…

inside a block can be statements or other blocks.

1 Like

Are you dyslexic? The bracket direction and placement may be hard to understand if so.

The syntax must be correct, one mistake with a bracket will cause the entire script to fail to compile. Look for little red squiggle underlines and examine what they are encasing, then fix the errors when you find them. If you can’t find them then you may not understand the syntax well enough and should look for tutorials on very basic syntax.

1 Like

No, i’m not dyslexic. But, my computer screen brightness was down at the time, but I doubt that’s why. It’s just me being me and messing up. Thanks though