C
C#2y ago
Werlon

✅ (Solved) Why am i getting this error?

33 Replies
sibber
sibber2y ago
$code
MODiX
MODiX2y ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat If your code is too long, post it to: https://paste.mod.gg/
sibber
sibber2y ago
at the very least put a little bit of effort into taking the picture lol and show the whole file
TheRanger
TheRanger2y ago
can u show the whole code oh, local variables can't have access modifiers
Werlon
WerlonOP2y ago
Alright one sec And what does that mean?
TheRanger
TheRanger2y ago
local variable is a variable that is defined in a method not in the class
Werlon
WerlonOP2y ago
Why can't it have access modifiers?
TheRanger
TheRanger2y ago
because the variable only exists in the method and gets discarded when the method ends its execution
Werlon
WerlonOP2y ago
Ah
TheRanger
TheRanger2y ago
you probably want a field instead
Werlon
WerlonOP2y ago
And the variables in the class stay?
TheRanger
TheRanger2y ago
yes
Werlon
WerlonOP2y ago
What's that?
TheRanger
TheRanger2y ago
when u define a variable in the class level, its called a field
Werlon
WerlonOP2y ago
Alright thank you
TheRanger
TheRanger2y ago
i advice u to learn the basics of C# before doing Unity
Werlon
WerlonOP2y ago
I did but i kinda forgor Was a year ago
sibber
sibber2y ago
relearn :)
TheRanger
TheRanger2y ago
^
Werlon
WerlonOP2y ago
Yup that's the plan
sibber
sibber2y ago
not alongside unity $close
MODiX
MODiX2y ago
Use the /close command to mark a forum thread as answered
Werlon
WerlonOP2y ago
Why not? I want to learn both And i get to learn c# along the way better in practice
sibber
sibber2y ago
learning at the same time will be significantly harder
Werlon
WerlonOP2y ago
Ah
sibber
sibber2y ago
its like learning physics and math at the same time you need to know math in order to learn physics
Werlon
WerlonOP2y ago
But i was having problems using c# It felt pointless because I didn't know what to do even if i knew how to code
sibber
sibber2y ago
theres $projects
MODiX
MODiX2y ago
Collections of application ideas that anyone can solve in any programming language to improve coding skills: https://github.com/dotnet/dotnet-console-games https://github.com/karan/Projects https://github.com/florinpop17/app-ideas
Werlon
WerlonOP2y ago
So I'm using a game engine to kinda make a point to work towards
sibber
sibber2y ago
learn the basics, create a couple simple ones, then go learn unity
Werlon
WerlonOP2y ago
Thank you
sibber
sibber2y ago
np
Want results from more Discord servers?
Add your server