What year e46? Does it have an N52? Check out SB 11 09 07. A family member had this issue. We switched the car from 0w40 oil to 5w30 (castrol edge) oil and it eventually went away (running it hard also helps).
https://techtips.alleuro.com/wp-content/uploads/2017/09/bmw-n52-Ticking-Noise-SBSI-B-11-09-07.pdf