Hello there! So I have been messing around with Unity3D for the last year, and I’ve gotten pretty good at it. However, there is one key thing in making unity stuff that I don’t know. It’s how to code in Js/C#/Boo. I try a lot of tutorials online, they give me some code and I paste it into MonoDevelop. But each time I try to run the game, it says there’s an error with the script. There was once a guy that rather than giving a block of text to copy/paste, he gave the script as a free download. It came out just fine, so I don’t know what I’m doing wrong. Any help would be appreciated!
The error looks like this :
[35785-skærmbillede+2014-11-25+kl.+10.43.22.png|35785]
By the way, here’s the code I’d like to use :
var target : Transform;
var moveSpeed = 3;
var rotationSpeed = 3;
var myTransform : Transform;
function Awake(){ myTransform = transform;
}
function Start(){ target = GameObject.FindWithTag("Player";).transform;
}
function Update () { var lookDir = target.position - myTransform.position; lookDir.y = 0; // zero the height difference myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(lookDir), rotationSpeed*Time.deltaTime); myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
}
I’ve found the unity manual/scripting data base helpful in learning to code. I’ve had some bare minimal training though (one or two intro to java and such) that gave me a starting point. I’ve watched the “Hack and Slash tutorial” from burgzergarcade that really takes you through alot of different things. Starting with making a basic character and mob, to building off of those to make more complex things. Testing each line as you go to make sure it’s doing what you want it to.
Since then I’ve been using what I know and asking stuff here when I couldn’t find it through searches. But its really good to understand what the code you’re using does. And at least a basic understanding of how the commands are suppose to work. I’ve tried with java and with C# (I find i prefer C#) and haven’t done anything with Boo… though that might change.
Try searches… brush up on basics… watch/read tutorials, and if you still can’t find the answer then you still have here
Going to answer by explaining the error line.
Assets/EnemyAI.js - file that has the error
(9,59) - location of error (line number in file, column of that line)
BCE0044: - Error code (You may search the internet for it to find out more)
unexpected char: - name/short description for error code
0xAD - character code of the character(semicolon “;”) that is causing this error