Absolutely. However, it is important to note that there are a very large number of obese people who don't eat sugar.
So sugar, while deservedly notorious, is far from the only highly significant factor, yet it sometimes receives 100% of the blame.
One of the several problems with that is that, due to popular perception, many will swear off sugar and yet still be unable to drop to a healthy weight.