Tutorial Ball Won't Move

Hi, I’m a complete newb to both Unity and the forums, apologies if this has been answered a million times before.

I’m following the Unity Roll-a-Ball tutorial. I just got to the step where I add movement to the ball with a C# script. My script is verbatim the same as the one in the tutorial video, but my ball doesn’t respond to keyboard input.

I’ve already checked the Input manager, and the correct buttons are set up for the horizontal and vertical axes, and I made sure that my ball has a rigidbody and that the plane has a mesh collider. I’ve added a speed variable so I’m fairly certain the problem isn’t just incredibly slow movement. I also moved the ball up in the air, just to check that physics was working correctly. As expected the ball fell and landed on the plane.

Can anybody think of something basic I’ve forgotten? The videos don’t have a list of common mistakes or anything, and I’ve checked everything I know enough to check.

off the top of my head: - be sure the ball script is sitting on the ball gameobject - Rigidbody can't be Kinematic - None of the colliders can be triggers - put a 'Debug.Log("I moved!");' in your script to see if the script is executed - try exaggerating values (add force or velocity of 100000000). - uncheck all constraint checkboxes on the ball... - Try attaching your Monodevelop to Unity and setting a breakpoint on your relevant movement code to see with which vlaues it is executed

3 Answers

3

It happens, when unity stop refreshing. Try to reimport manually all of the scripts and assets, or just restart the Unity. I have had this problem before, and it can be really annoying. I hope that helped.

joonturbo’s comment led me to find that my log wasn’t reaching the console, and I eventually realized that I was calling fixedUpdate not FixedUpdate. Thanks for your help guys!

For anyone else who hit this problem - a pointer from a Unity noob.

You did under the player properties - player controller settings - where it says the script name… set a speed value? (the default is 0). As we know - anything times 0 is 0… hence no movement.

I shall sit in the corner now.