C
C#7mo ago
Blitz

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
No description
No description
15 Replies
Jimmacle
Jimmacle7mo ago
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
Blitz
Blitz7mo ago
How do I put it in a namespace?
Blitz
Blitz7mo ago
Should it be like this?
No description
Blitz
Blitz7mo ago
And I should copy that class line and put it between lines 32-53?
Angius
Angius7mo ago
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 some
Blitz
Blitz7mo ago
Alright so what am I exactly suppose to do?
Angius
Angius7mo ago
I just told you 1. Name the namespace properly 2. Place the aforementioned code where you want it to be executed
Blitz
Blitz7mo ago
So name it something like this?
No description
Blitz
Blitz7mo ago
Since I have the script in my Characters folder
No description
Blitz
Blitz7mo ago
Alright last thing, I got the same error on a different line
No description
Blitz
Blitz7mo ago
This is the code now
No description
Jimmacle
Jimmacle7mo ago
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
Angius
Angius7mo ago
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