It's just not that simple, and that's the issue. And this kind of over-simplification can lead to a lot of victim blaming.
The role of sugar (especially fructose) and carbohydrate intake in obesity is very important, and there's far more to it than that.
I think it'd be a lot more challenging for someone to be obese with the same caloric amount of avocados than cheetos, for example.