✅ Brand new to C# and Unity
For some reason my else statement isnt attaching to the previous if. Im wondering if i missed something or not. I recently set up sprinting right before it, and heard you can only put one update per class, so i have to cram all my movement updates into this one area, and it looks just like a bunch of if else statements spammed everywhere.

15 Replies
U can do maybe a switch case for the key?
In English? I literally just started learning unity and c# after getting off work last night (and am at work right now too)
Just wondering what exactly you mean by switch case
if and switch statements - select a code path to execute - C# refer...
The
if
and switch
statements provide branching logic in C#. You use if,
else and
switch` to choose the path your program follows.Thanks :rethaepwease:
little late but you have a random semicolon on the end of the line with the if
you've effectively written
I suggest you learn C# without a game engine, it will be significantly harder to learn C# from Unity.
$helloworld
Start from there
But I have so many ideas, my brains gonna explode
I must code
Learning by doing
I’ve been reading over this and it talks about using values later in code
Ontop of that I remember in unity the public/private method
Do returns/public carry over scripts, or stay within there own confined spaces. I’ve seen some people mess with speed values for movement, for example.
One person set all of them to public, while the other set 80% of them to private
I’ve read that these allow them to be accessed on a broad basis, and likewise be accessed only within its enclosed space, but how does that actually work.
If you have a private move speed value set up, does that mean if you make an “enemy” for example, and give them the same private move speed value, they can be two different values? Or what if you make one public and the other private.

I’m very bad at picking up languages and such, and it’s been evident ever since I stopped taking my focus medication, but my old doctor has moved away and I never liked it anyhow.
If yall could, in any way, dumb this down for me, I’d appreciate it
These kind of questions are perfect to ask Ai. I find they are really good at explaining programming concepts. You can even ask it to explain to you like you’re a 5 years old, or use analogies and such. Just don’t use it to generate code for you, unless you know exactly and understand perfectly what it does.
Also if you want to learn to program while making games, you should look up for MonoGame which is a free open source C# framework for game development. Its uses a "code-first" approach. This means that, unlike game engines such as Unity or Unreal Engine which provide visual editors and interfaces for game creation, it focuses on writing code to control all aspects of the game.
Looks like you got a ; at end of if on line 85
That is usually an end of statement for c#
Unknown User•3d ago
Message Not Public
Sign In & Join Server To View