Hello, I wanted to make controls for a player with the new Input System using a video from YouTube. I generated the code in Unity itself, added binds (WASD, Space), wrote code that tracks clicks, etc. (everything is based on the video on YouTube) but nothing happened: the player just stands there and doesn’t react.
All i want: fully working script for player movement, camera movement, jumping. And if you give me advice on writing code I will be grateful
I am new in codding, so i wold be happy if u help me:)
When following a tutorial, you should make sure to do everything exactly as the tutorial shows.
You know the tutorial works because it works for the person who created it. You also know you’ve made a mistake, and that the problem is not caused by a library or framework. Finally, you know the error lies within a very constrained area: what is covered in the tutorial.
That makes this an ideal opportunity to sharpen your debugging skills. Start from the beginning of the tutorial and identify what you did differently. Go through it line by line and double check everything. If you still can’t find the mistake, start over and repeat the process until you do.
This is what consumes most of your time in real development. Take advantage of this moment to learn debugging and get comfortable with it, you’ll need to do it many more times without the luxury of knowing what to look for or where to look.
That may be what you want right now, but it certainly will not be enough in the future, since you are going to need many more scripts beyond this one. Instead of looking for a ready-made script, you should follow tutorials to understand what is happening and why, rather than just copying the code they provide.
Try following the tutorial again from the beginning, using the approach described above to find the bug. This time, focus on understanding what is happening at each step and why it is happening. If you do not like that particular tutorial, you can always try the official https://learn.unity.com tutorials instead.
The same advice applies to all tutorials: do not just look for a script that does something, because most of the time it will not work exactly for your specific use case. Instead, use tutorials to learn how to create those kinds of scripts yourself.
Send me a script / the scripts please!
What kind of player? 2D? 3D? first person? third person?
HURRY, DO NOT WAIT… get to some Youtube tutorials.
If you can’t learn from those, I promise you nothing in this box will help you either.
Be sure you understand how to learn:
Two steps to tutorials and / or example code:
- do them perfectly, to the letter (zero typos, including punctuation and capitalization)
- stop and understand each step to understand what is going on.
If you go past anything that you don’t understand, then you’re just mimicking what you saw without actually learning, essentially wasting your own time. It’s only two steps. Don’t skip either step.
Step #2 is particularly critical when learning.
If you are unwilling or unable to do Step #2, just ask someone else to do the whole game for you.
Imphenzia: How Did I Learn To Make Games:
The 3-Game Path for Indie Devs (Don’t Skip The First Two)
Thanks for your reply. I watched a lot of videos on YouTube, looked for answers on GitHub, Reddit and many other sites. But all the scripts that I copied from YouTube authors did not work. I double-checked every word thoroughly, turned to the AI, but nothing came of it. I will watch your video and cites of the person above that you sent me.
And I’m looking for a normal script, not just CTRL+C, CTRL+V it into the engine, I need an example of how to do it all. I looked for them on YouTube but didn’t find anything as I already wrote.
Thanks for the answer again
If none of them worked, it may be because they use the old Input System, while newer Unity versions are preconfigured to use the new one.
To make Unity work with the old input system, go to Edit → Project Settings. In the Player tab on the right, find the option Active Input Handling. If it is set to Input System Package (New), change it to Input Manager (Old) and click Apply.
Alternatively, you can select Both if you want the project to support both input systems.
if you want something you just paste in, you are not learning from it. You’re just getting others to do your work for you.
There are hundreds if not thousands of tutorials showing you exactly this.
If they are not suitable for you, I’m not kidding: nothing in this box will be either.
This isn’t like “How do I change my air filter?”
This is software engineering.
Again, review the two steps above. If you get to the end of a tutorial and you do not understand 100% of what you did and why you did it, rewind and start over.
Try writing down on paper what each step is. These are all just basic grade school learning techniques but this is why the teacher taught you them.
Or just find someone who can do it for you.