Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialThomas Wardhaugh
Courses Plus Student 485 Points"all compiler errors have to be fixed before you enter playmode.".. what does that mean?
okay so l did all the coding right or it seems and watched the video a couple times to double check, but wehen I tried to enter playmode it wouldn't work and it said, "all compiler errors have to be fixed before you enter playmode." 1) i have know idea what that means since I've just started coding video games and 2) I don't know how to fix it. so if someone could help me that would be great, Thanks
here's a copy of my coding:
using UnityEngine; using System.Collections;
public class playermovement : MonoBehaviour {
private Animator playerAnimator;
private float moveHorizontal;
private float moveVertical;
private Vector3 movement;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
moveHorizontal = Input.GetAxisRaw("Horizontal");
moveVertical = Input.GetAxisRaw ("vertical");
movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
}
}
Amarullah Aslam
14,534 PointsReplace small v with Capital V for axis name
1 Answer
Alan Mattan贸
Courses Plus Student 12,188 PointsQuestion: "all compiler errors have to be fixed before you enter playmode.".. what does that mean?
[I'm learning english, my english is not good]
When you hit "play" button on top to enter in play mode, then this message appears to prevent running the game with errors that can crush or freeze the editor. So you need to fix error first. The console window is useful for debugging what is wrong. If it is not open, go to unity top bar Window -> Console or hit Ctrl+Shift+C. In it there will be one or more errors. Read the first one. It will tell you the name of the script, the line where is the error and the position of it. You can double click the error and the Mono or Visual Studio editor will open showing you the position with the cursor in where is the error (close to the error).
I thinks the title of your question is different from what you are asking or you are making 2 questions here.
Question: How to fix it?
Look the position of the cursor first (in VS or Mono). The error can be before or after this position of the cursore but not too far away.
probably it will select the line where is the error and in your case is:
moveVertical = Input.GetAxisRaw("vertical");
moveVertical and Input.GetAxisRaw do not has a red line under it so probably are correct. There is also a correct line ending (""); probably "vertical" is not declare in the Input system. In this case looking "Horizontal" is with capital letter and "vertical" is not (as Amarullah Aslam comment). Since coding is case sensitive you probably need to fix this in your case.
So select in the unity toolbar, Edit -> project Settings -> Input and in the Inspector you will find Axes. Expand the list. here you find all the inputs Name and in this case is Vertical.
moveVertical = Input.GetAxisRaw("Vertical");
Hope this answer your questions.
Thomas Wardhaugh
Courses Plus Student 485 PointsThomas Wardhaugh
Courses Plus Student 485 Pointssorry looks like some of the coding got cut of but just fyi after the collin were it says "here's a copy of my coding to the end of the post is the coding =)