- Home /
I found this code in a youtube tutorial, and the speed is a little slow. I tried to increase the value of 'movespeed', but it didn't seem to work.,How do I increase the speed?
,I found this code in a youtube tutorial, and the speed is a little slow. I tried to increase the value of 'movespeed', but it didn't seem to work.
it's a public variable so you have to change it in the unity editor. the unity editor value overrides what is in code. Try that.
Answer by Duckocide · Mar 09, 2021 at 02:08 PM
Code looks OK although mixing direct changes to transform position and physics (add force) isn't always best (can cause odd behaviour when in collision and this might be the issue - object is in collision with surface). You might want to consider applying forces on the x axis the same way you are jumping. So not part of jump code, but similar apply force in x direction in "FixedUpdate" (not update as physics happier with fixed frame periods)
That said, it's all about scale. Your move code means move at max 10 units per second depending upon horizontal axis deflection (delta Time is fraction of second per frame). So, if the scale of your scene is really big, a change in move speed might be unnoticeable.
Answer by LeVoid · Mar 09, 2021 at 06:01 PM
@murtaazathegoat It is a public float so maybe you have accidentally changed the value in the unity editor. When you click on the object that has the script on it and look at it's script component in the inspector window, then you can influence the value movespeed from there.
Sometimes the value gets stuck on whatever you set it to, when you change it in the script. Try looking at the script in the inspector.
Your answer
![](https://koobas.hobune.stream/wayback/20220613030419im_/https://answers.unity.com/themes/thub/images/avi.jpg)