Unity Build Help

Hi I am new to Unity and new to the site. I am an interactive media student at Bournemouth Uni and so far have built two very simple games. I am getting a problem every time I build the Game (Mac PC Standalone) a script of mine (enemyMove) fails to work. The script itself simply makes my enemies move towards the main character and works fine when I play it within Unity.

The script is as follows:

var mySpeed : float = 50;

function Update () {

var fwd : Vector3 = transform.TransformDirection(Vector3.forward)*mySpeed;

rigidbody.MovePosition(rigidbody.position + fwd);

}

Any ideas as to the answer of my question?

cheers joe Wheater

I’m not sure why the behavior is differing between the editor and the build, but you’ll probably want to a) move the code in question to FixedUpdate(), and b) scale the movement vector according to the time step (see the docs for MovePosition() for an example).

Also, this:

var fwd : Vector3 = transform.TransformDirection(Vector3.forward)*mySpeed;

Can instead be written as:

var fwd : Vector3 = transform.forward*mySpeed;