Advertisement

Can someone help me with my code in Unity?

Started by August 07, 2021 11:56 PM
5 comments, last by Alberth 3 years, 3 months ago

I'm following this tutorial on Youtube on how to create a game. it's called “ How to make a video game in Unity - MOVEMENT(E03)" and Im currently stuck in 5:37. The code is supposed to make the character move to the right when clicking d, but it's not working. It shows this error in Unity.

Here's the code. Is there a problem with the code? or with unity or VSCode? Thanks for ur help!

Imput? Should be Input I would think.

(17,28) Means the error is around line 17, character 28.

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

Advertisement

@undefined That's an old mistake I already fixed that and it still doesn't work, and thanks I didn't know that. I think it means that the If statement is wrong but I don't see What's wrong. I did everything exactly to the tutorial. I even restarted VS Code and Unity a couple of times but nothing works… do u see any other mistake? maybe it's a setting in VSCode?

Lowercase “if” likely works better.

All these problems are standard C# things, the best way to deal with these is to learn plain C# for a few weeks so you made all the common mistakes and learned how to fix them.

Disaster said:
I did everything exactly to the tutorial.

You may believe that, but if a computer says otherwise it's usually correct even if it doesn't seem that way.

We are just very bad at reading (we skip about 50% of the letters of a sentence).

@Alberth OMG!!! Turns out I didn't do everything exactly to the video… I feel so dumb rn. but now I know it wasn't a mistake in VS Code, I'm just dumb. Thanks so much for ur help! I will study c# more!

Don't worry about, every programmer has run into this at some point. What you need to get used to is that computers are much more precise in what they consider correct, and that such differences can exist even if we don't see them (at first).

Sometimes I still study a line of text for several minutes where the git program says there is a difference but I don't see it. Usually I find it, but sometimes I get fed up, and use another program to point out the difference more precisely. In the latter case, there always is a difference of course, but sometimes hidden like in 2 spaces versus 1 space.

In this case, your problem is not being experienced enough to see “If” as incorrect because you haven't seen it often enough.

If you want to speed up that process, a good way is not to copy/paste code but instead use the keyboard to type it manually. It may seem counter-productive, but that makes a world of difference in memorizing the common patterns into your head. (Your brain will start finding similarities between lines and in time you will learn why these differences exist and what they mean.)

As a second tip, when you're stuck on a problem and you're out of ideas what to try next, stop working on it. Try again a few hours later or the next day, when you're more awake.

This topic is closed to new replies.

Advertisement