Does lack of exercise affect mental health/anxiety?

I stopped going to the gym maybe a year ago. Since then I’ve noticed my anxiety has gotten super bad. Idk if that may have an affect on it? Any advice appreciated ❤️