- Home /
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 $$anonymous$$inematic
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 $$anonymous$$onodevelop to Unity and setting a breakpoint on your relevant movement code to see with which vlaues it is executed
Answer by blaknwhitejungl · Nov 17, 2013 at 08:06 PM
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!
Answer by MrAkroMenToS · Nov 17, 2013 at 01:57 PM
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.
Answer by atleast6 · Oct 31, 2016 at 10:11 PM
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.
Your answer
Follow this Question
Related Questions
Moving AI away or towards player not working correctly. 1 Answer
Audio PlayOneShot Help 1 Answer
Having trouble with a basic movement script. 2 Answers