Shooter game bullet doesn't translate by currect direction with currect Unit Vector component set

public class NonSpellFairyControl : MonoBehaviour {

    public float Speed;
    public GameObject FairyBullet;
    Vector2 topRightConner = new Vector2(10.2f, 4.9f);
    Vector2 bottomLeftConner = new Vector2(-10, -4.9f);
    float[] BulletPath = new float[] { 22.5f, 45.0f, 67.5f, 90f, 112.5f, 135f, 157.5f, 180f, 202.5f, 225f, 247.5f, 270f, 292.5f, 315f, 337.5f, 360f};
    public static float BulletDirection;
    // Use this for initialization
    void Start ()
    {
        GameObject boss = GameObject.Find("Alice");
        if (gameObject.transform.position.x < boss.transform.position.x)
        {
            Speed = -Speed;
        }
        InvokeRepeating("ShootBullet", 0.1f, 1f);
    }
   
    // Update is called once per frame
    void Update ()
    {
        gameObject.transform.Translate(Speed * Time.deltaTime, 0, 0);
        
    }
    void ShootBullet()
    {
      
        GameObject Bullet1 = Instantiate(FairyBullet); 
       
        BulletDirection = BulletPath[0];
        Bullet1.transform.Rotate(0, 0, DeterMineBulletRotation(BulletPath[0]));
       
      
    }
    float DeterMineBulletRotation(float TravelDirectionDegree)
    {
        // When Rotate respect to Z asxis 0 degrees is corsponding to 90 degrees in normal sense, and 0 degrees in UnitCircle is -90 in this case
        float rotationDegres;
        rotationDegres = -90f + TravelDirectionDegree;
        return rotationDegres;

    }
}

So I set the static field BulletDirection to 22.5 in this case in the spawner, the bullet does get the 22.5 from this script and it does show 22.5 everytime in Debug.log but instead translate in 22.5degree postive it trnslate 22.5 degrees negative.
Here is the code in the bullet script

public class NonSpellFairyBulletControl : MonoBehaviour {

    public float Speed;
    float BulletPath;
    Vector3 UnitVector;
    // Use this for initialization
    void Start ()
    {
        BulletPath = NonSpellFairyControl.BulletDirection;
        Debug.Log(BulletPath);
        BulletPath = Mathf.Deg2Rad * BulletPath;
        UnitVector = new Vector3(Mathf.Cos( BulletPath), Mathf.Sin(BulletPath) , 0);
    }
   
    // Update is called once per frame
    void Update ()
    {
        gameObject.transform.Translate(Speed * Time.deltaTime * UnitVector.x, Speed * Time.deltaTime * UnitVector.y , 0);
                                      
    }
}


This is the scene while the game play, why the bullet doesn’t translate on 22.5degree postive(Green Arrow) path?

When you call NonSpellFairyControl, you are basically calling the base script, if you want to do this, either do:
GameObject.FindGameObjectWithTag(“Fairy”).GetComponent().BulletDirection;
or if you want a faster method, set the value of the Bulletpath in the script that instantiates these bullets

Lerp the bullet in forward direction like Vector3.Lerp(fromPos,toPos,Time.timevector3.forwardspeed);

Hi, I think there is something more to it, when I comment out the rotation part of the script, line 32 in NonSpellFairyControl
the bullet does translate in postive 22.5 degrees, so the rotation part seems also interfere with the translation. The speed is set to positive in the inspector. Maybe this is not the right way to set an object’s rotation to a certain degrees respect to an axis?

It’s probably because Translate uses local space by default. Try this instead:

gameObject.transform.position += UnitVector * Speed * Time.deltaTime;

Thank you that did it, so when it translate respect to local space, the axis is arealy rotated, translate would translate add on to the rotation it arealy has is that what happened?