Depression in pregnancy affects child?

So I've read a lot about how when a mother experiences trauma during her pregnancy it affects the baby's developing brain and will affect them later in life emotionally give them anxiety or depression or whatever the case may be. I'm so worried about this now bc when I was pregnant with my son my marriage was awful I felt suicidal at times in my pregnancy, but didn't bc of my baby. It was one of the darkest times of my life, I'm doing better now and my son is 8 months old happy and healthy, but I'm worried now He's going to have problems with his mental health bc of my pregnancy. Does anyone know anything about this? Is it always the case or there's just been a correlation between the two sorta thing? Anyone knowledgeable on this?? I'm feeling a lot of guilt😪