- Home /
Duplicate Question
Roll A Ball- "All compiler errors have to be fixed before you can enter playmode!"
I'm trying to do the Roll A Ball tutorial but I'm stuck at moving your player. I have programmed before and I am positive there is nothing wrong with my code. I will post it below. It's just the basic first code that the tutorial has you set up to move the ball right after it has you set the speed (note: It didn't work before I added the code for the speed but I wanted to jump start and add it anyway). Any help would be so appreciated! I want to finish this and keep learning!!!
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
public float speed;
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
Rigidbody.AddForce(movement * speed * Time.deltaTime);
}
}
Thanks!!
Update: I sent the program file to my buddy who has Unity and he said it is working fine for him. I still can't get it to work. I'm going to reinstall Unity and try that. But if that doesn't work I have no idea what the deal is.
Tried running in Ad$$anonymous$$ mode?
Got $$anonymous$$ono installed? (And whatever VS runtime is req)?
Got .net stuff installed?
Answer by robertbu · Aug 14, 2014 at 05:42 AM
I am positive there is nothing wrong with my code
If I had a dime for every time someone made this claim on this list when there was issues with the code.... ;)
One problem that jumps out at me is on line 8, 'Rigidbody' with an upper case 'R' should be 'rigidbody' with a lower case 'r'. 'Rigidbody' is the class. 'rigidbody' is a Unity provided short-cut variable that gets the rigidbody component on the game object. You will see this kind of thing in Unity: Transform vs transform, Collider vs collider, Renderer vs renderer... And the auto correction of Monodevelop makes this issue worse since it often changes things like transform to Transform to "help" you.
Thank you so much!! I searched so many threads on this site but couldn't find this one specifically. I only learned to program on Java and I've never done C# ever. This is my foray into deciding if I want to make video games for a living. So. I want to $$anonymous$$ch myself as much as possible so I can make an educated decision. Once I see this ball actually move I will probably freak out. Haha. Thanks again. For some reason the compiler wouldn't tell me where my error was. Is there a way to get it to point out the line that there is an error on? I've tried what everyone says about clicking on the red error message but that doesn't work.
It's double click on the error message to highlight in $$anonymous$$onodevelop. On my Windows mancine, I have to switch to $$anonymous$$onodevelop by hand. Also on Windows, if $$anonymous$$onodevelop is not running, the first time I double click, the wrong file is sometimes displayed. A second double click works. On the $$anonymous$$ack, the $$anonymous$$onodevelop is brought to the foreground and the correct line is displayed first time. Note the error itself includes the line number and usually and offset as well. Just before the error you will see something like (33,12) which means the error is on line 33 and the 12 character on that line. But this is just the point where the compiler got confused enough to throw the error. Often the error is in the line before or sometimes many lines before.
Check out my answer on this QA @iChealseaSmileU for extra info in the case that Console shows nothing.
I still cannot figure this out. I changed the uppercase R to a lowercase r on rigidbody. Everything else I kept the same. And I can't find anything anywhere that says what line the error is on. This is so frustrating. I don't want to give up but I need help. If it's an issue with Unity that's different, but I just have no clue why it isn't working. This stupid ball is never going to move.
And I can't find anything anywhere that says what line the error is on.
Did you read the QA?
Follow this Question
Related Questions
Internal compiler error 2 Answers
Roll-a-Ball Compiler Errors 0 Answers
Compiler errors while switching to android 1 Answer
Unity Compiler Error Glitched. 0 Answers
Problem with Mono compiler 0 Answers