Heredity plays a role in obesity but generally to a much lesser degree than many people might believe. Rather than being obesity’s sole cause, genes seem to increase the risk of weight gain and interact with other risk factors in the environment, such as unhealthy diets and inactive lifestyles. And healthy lifestyles can counteract these genetic effects.