My character from blender moves side ways (How to rotate the model)

var speed = 3.0;
var rotateSpeed = 3.0;
var BullitPrefab:Transform;
var jumpSpeed = 5.0;

function Update ()
{

       var controller : CharacterController = GetComponent(CharacterController);

       // Rotate around y = axis
       transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed * Time.deltaTime, 0);

       // Move forward / backward
       var forward = transform.TransformDirection(Vector3.forward);
       var curSpeed = speed * Input.GetAxis ("Vertical");
        if(Input.GetKey(KeyCode.S))
       {
       curSpeed *= 0.6;
       }
       controller.SimpleMove(forward * curSpeed);

    if (Input.GetButtonDown("Jump"))
  {

        var bullit = Instantiate(BullitPrefab, 
        GameObject.Find("spawnpoint").transform.position, 
        Quaternion.identity);

    bullit.rigidbody.AddForce(transform.forward * 200);
var jumpSpeed = 5.0;

  }

RequireComponent(CharacterController);
}

here is my script for player movment for some reason my charcter moves sidways to the left when i press forward and to the right when i press down maybe i imported it wrong in to unity i dont know however how could i fix this

please help thanx ;)

As you say, the model was created facing the wrong way. To fix this either make the model again facing the right way or put the model into an empty game object in unity and rotate the model so that it's facing the empty game object's forward direction (red arrow is right, blue arrow is forward)

Put the character movement script on the empty game object, not the model.

facing the model the “right” way to work in Unity is the “wrong” way in blender so it is annoying. Here’s a good fix though found here: http://forum.unity3d.com/threads/97119-Z-and-Y-Axis?p=842046&viewfull=1#post842046

"Steps to solve problem:

  1. Select object in Blender and rotate on X-axis by -90 degrees (don’t panic! we’ll fix it for Blender and Unity)
  2. From “Object” menu select “Apply > Rotation”
  3. According to Blender the object is no longer rotated. Rotate object by 90 degrees and presto!

Orientations are now correct in both Blender and Unity with rotation (0,0,0) in Unity and (90,0,0) in Blender!"

It works because rotating in “object” mode doesn’t apply the rotation in the edit (like you accomplish with Apply > Rotation.)

Also be sure you do the same thing to your armature if you have one!

It would be nice if the automatic import in Unity would do this for you and hopefully that fix will come, but this is a way to do it without adding an extra gameobject for every object in game. It’s also easily reversible (just Apply > Rotation again)