Well, let's put it this way. If you stopped eating, would you keep gaining weight?
Nope, of course not.
Genetics can only make it harder to lose weight. Not impossible. And they can't cause you to put on weight that you aren't eating enough to create. The familial part of weight loss is usually not in the genes, it's in the habits that parents gave to their children. And most people who gain a lot of weight have insulin resistance AKA metabolic syndrome, which develops because of eating lots of sugary and carby foods, and the way to fix it is to eat less of those foods and more whole grains, proteins, healthy fats.
Honestly I was overweight as a kid/preteen and at the time I thought, "why am I still gaining weight?" I thought something was wrong with my thyroid or I just had bad genes, but when I really got serious and lost the weight, I saw how overly simplistic and self-enabling my mindset had been.
And I'm not saying that like some health preacher, I'm just saying your body is not conspiring against you to gain weight; it is caused by habits and it can only be fixed by changing those habits.