- Home /
MonoDevelop "Build failed. Illegal character in path."
I have just started using Unity with limited programming experience. I have an issue with MonoDevelop when I want to build my script to allow a sphere to roll left and right.
#pragma strict
float rotationSpeed = 100;
var rb : Rigidbody;
function Start ()
{
rb = GetComponent.<Rigidbody>();
}
function Update ()
{
float rotation = Input.GetAxis ("Horizontal") * rotationSpeed;
rotation *= Time.deltaTime;
rb.AddRelativeTorque (Vector3.back * rotation);
}
The error is just as the title states "Build failed. Illegal character in path."
Strangely enough, Unity thinks the error is quite different:
When I comment out everything meaningful in my code, the error is still persistently sitting there meaning that this error is not related to my code. This doesn't help and after frustratingly long research, I still didn't find a way to satisfy it. I assume that if this is not resolved, I won't be able to write any other scripts in the future which will greatly limit my possibilities. Your help will be appreciated, thanks in advance.
your script is a .js (Unityscript) but float rotationSpeed = 100;
is C# syntax, perhaps you mean rotationSpeed :float = 100.0;
sorry, just read your question properly, though the errors in code is what unity is complaining about, the monodevelop complaint is probably something else as you say. Is there anything strange in your Username on the computer, foreign letters etc?
Try replacing the C# code in your javascript file with javascript code
#pragma strict
var rotationSpeed : float =100;
var rb : Rigidbody;
function Start ()
{
rb = GetComponent.<Rigidbody>();
}
function Update ()
{
var rotation : float = Input.GetAxis ("Horizontal") * rotationSpeed;
rotation *= Time.deltaTime;
rb.AddRelativeTorque (Vector3.back * rotation);
}
and clearing the error messages. Compile time error messages remove themselves as they are fixed. Build time/run time error messages cannot detect if the changes in code would have fixed them and they remain in the log until they are manually cleared.
Answer by Atristiel · May 24, 2015 at 05:37 PM
No, there are just English letters everywhere over my computer files etc.
Sorry, I was learning a bit of C# beforehand and I thought var was a bad practice. Maybe it is in C# but I should adapt to Java Script when working with it I guess.
After I went along with your suggestion to fix syntax to Java Script, the error still appeared no matter what but when I looked into Unity, there were no errors. Out of curiosity, I pressed Play again and this time it actually worked!
As confusing as it was lessons to be taken out of this is that I should stick with a language's syntax and that this compiler error is irrelevant as long as Unity likes it.
Thanks for your time and advice guys.
Yeah... using Drow sign language to speak to a $$anonymous$$lingon probably wouldn't go over very well either.
Your answer
