Instantied projectiles getting affected by parent's animation.

An enemy in my game shoots four different projectiles with a animation trigger event calling the method. In order to keep a tidy hierarchy, I instantiante them as child objects.However, part of the animation loop involves changes in movement, and somehow every instantiated children also stops during that time. I can avoid it by not using a parent connection, but is there any other way around it?

The shooter code:

 public void Shoot()
    {
        foreach(GameObject projectilePre in projectilePrefabs)
        {
            GameObject projectile = Instantiate(projectilePre, transform.position, Quaternion.identity) as GameObject;
            projectile.transform.parent = transform;
        }        
    }

And the projectile:

public class Projectile : MonoBehaviour
{
    [SerializeField] float speedY = 1f, speedX = 0f;

    private void Start()
    {        
        GetComponent<Rigidbody2D>().velocity = new Vector2(speedX, speedY);
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        Destroy(gameObject, 0.05f);
    }
}

You can’t set the projectile to be a parent of a dynamic object. It has to be an empty objects attached to a static like gameobject.

Simple way is to just assign it to a static transform.

Advanced way is to have a gameobject containing projectiles and activating them at the right pos, rot etc, instead of instantiating them. (More performant)

If it is a fast firing riffle for eg, it is better to use raycasts. Performant and better calculation.