Pcos weight gain??

Does gaining weight sometimes cause you to get pcos?? Because I’ve gain over 20lbs since April never been this heavy in my life I always had regular periods then all of a sudden last month I had no period I go into the doctor for testing and my doctor tells me I might have pcos now 😪 I’m so sadd how do I get rid of this if I change my diet and lose all this weight will things go back to normal