33 Replies
$code
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/at the very least put a little bit of effort into taking the picture lol
and show the whole file
can u show the whole code
oh, local variables can't have access modifiers
Alright one sec
And what does that mean?
local variable is a variable that is defined in a method
not in the class
Why can't it have access modifiers?
because the variable only exists in the method and gets discarded when the method ends its execution
Ah
you probably want a field instead
And the variables in the class stay?
yes
What's that?
when u define a variable in the class level, its called a field
Alright thank you
i advice u to learn the basics of C# before doing Unity
I did but i kinda forgor
Was a year ago
relearn :)
^
Yup that's the plan
not alongside unity
$close
Use the
/close
command to mark a forum thread as answeredWhy not?
I want to learn both
And i get to learn c# along the way better in practice
learning at the same time will be significantly harder
Ah
its like learning physics and math at the same time
you need to know math in order to learn physics
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
theres $projects
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
So I'm using a game engine to kinda make a point to work towards
learn the basics, create a couple simple ones, then go learn unity
Thank you
np