- Home /
Making a 2D Game, Flipping Textures ERROR
var X : float;
function Start () { //Gathering normal object scale x X = transform.localScale.x; } X = transform.localScale.x; } function Update () { if(Input.GetKey(“a”)){ //Gamer pushes a key //Set texture to normal position. transform.localScale.x = X; }else if(Input.GetKey(“d”)){ //Push d //Flip the texture transform.localScale.x = -X; } if(Input.GetKey("a")) { transform.localScale.x = -X; }else if(Input.GetKey("d")){transform.localScale.x = X; } }
So I have that. And I am getting this error:
Assets/Scripts/TextureFlip.js(6,20): BCE0044: unexpected char: 0x2028.
I have no idea what this means; I cant find those numbers anywhere. Please help me!
Answer by robertbu · Feb 22, 2014 at 06:36 AM
I believe there are some characters in this text with values above 128. I could not format the code, and when I pasted it into Monodevelop, it did strange things including hide all the comments. I cleaned up just the code using another editor, and now it compiles.
#pragma strict
var X : float;
function Start() {
X = transform.localScale.x;
}
function Update () {
if (Input.GetKey("a")) {
transform.localScale.x = -X;
}
else if(Input.GetKey("d")) {
transform.localScale.x = X;
}
}
Please post comments as comments. An answer means a solution.
Also, in the future, do remember to mark the correct answer using the check mark below the thumbs.