Help with Code in Unity
I keep getting this error in Unity and I don't know what I'm doing wrong. I'm new to C# and got this from a youtube tutorial


15 Replies
for one, your class is not in a namespace
but your actual error is because you have code in your class that should be part of a method but isn't
lines 32-53
How do I put it in a namespace?
Should it be like this?

And I should copy that class line and put it between lines 32-53?
You probably shouldn't name the namespace
class
Namespaces, customarily, follow the folder structure in the project
And lines 32-53 should be inside of some method
Idk which one exactly, but someAlright so what am I exactly suppose to do?
I just told you
1. Name the namespace properly
2. Place the aforementioned code where you want it to be executed
So name it something like this?

Since I have the script in my Characters folder

Alright last thing, I got the same error on a different line

This is the code now

i think you should stop copying and pasting things and learn basic C# syntax
unity is kind of a rough place to start if you're a beginner
$helloworld
Well, yeah, pretty much the entirety of your code is outside of the class now
I second Jimmacle here
Learn the basics of C# first