- Home /
0xFEFF error im new PLEASSE help. Script error
im new to unity and got a 0xfeff error and I dont know what that is could you please help it would be highly appreciated. im trying to make a pong style game. so heres my script.
//declare the raycast objects here so we dont need to instatiate then each frame private var ray : Ray; private var rayCastHit : RaycastHit; function Update()
{ if(Input.GetMouseButton(0)) ray = Camera.main.ScreenPointToRay (Input.mousePosition); if (Physics.RayCast (ray, rayCastHit)) { transform.position.x = rayCastHit.point.x; }
Answer by robertbu · May 25, 2013 at 02:05 AM
This problem occurs when there are high-ascii value characters in the text. Usually this happens when editors other than Mono are used to save or alter scripts. You can spot these characters by pulling the script into any editor that can display these characters. I pulled your script into Word and removed the 'bad' character. I also fixed a couple of other issues I spotted. Note for future posts, you need to format your code so that it is readable. Using the 101/010 button is part of that process. Here is your script without the character:
#pragma strict
//declare the raycast objects here so we dont need to instatiate then each frame private
var ray : Ray;
private var rayCastHit : RaycastHit;
function Update() {
if(Input.GetMouseButton(0)) {
ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray, rayCastHit)) {
transform.position.x = rayCastHit.point.x;
}
}
}