Enemy moving sideways

I have been making a game with enemies that follow and attack you when you get so close to them. I just imported a model from Blender3D when I give it a character controller and the AI script and everything it will follow and attack me, but for some reason it moves sideways. I can’t figure out why this is.

var distance;
var target : Transform;    
var lookAtDistance = 15.0;
var chaseRange = 15.00;
var attackRange = 1.5;
var moveSpeed = 5.0;
var Damping = 6.0;
var Controller : CharacterController;
var Gravity : float = 20.0;
private var MoveDirection : Vector3 = Vector3.zero;
var AttackRepeatTime = 1;
private var AttackTime : float;
var TheDamage = 20;

function Start()
{
	AttackTime = Time.time;
} 
function Update () 
{
distance = Vector3.Distance(target.position, transform.position);
 
 if(distance < lookAtDistance)
 {
 	lookAt ();
 }   
 if(distance < attackRange)
 {
 	attack();
 }
 else
 {
 	 if(distance < chaseRange)
 {
	chase ();
 }
 }
 }
 
 
function lookAt ()
{
 var rotation = Quaternion.LookRotation(target.position - transform.position);
 transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * Damping);
}
 
function chase ()
{
  
  moveDirection = transform.forward;
  moveDirection *= moveSpeed;
  
  moveDirection.y -= Gravity * Time.deltaTime;
  Controller.Move(moveDirection * Time.deltaTime);
}

function attack ()
{
	if(Time.time > AttackTime)
	{
		target.SendMessage("PlayerHit", TheDamage, SendMessageOptions.DontRequireReceiver);
		AttackTime = Time.time + AttackRepeatTime;
	}
}

Ah yes that’s a common and solvable problem. Its on Blender’s side. You have to rotate it differently in Blender and when you export fbx, export it under different Forward and Up coordinates in the export settings. It’ll take a bit of experimenting till you get it right but its fixable.

Another easier but messier fix is creating an empty game object and rotating it the way you want and parenting it to the enemy object, and ofc you’ll have to apply your enemy scripts to the empty object.

Might help if you put the Blender object “on its back” in the editor cause Blender and Unity use different world coordinates, that’s where the problem lays.