For me it was years ago when my doc told me my high blood pressure level was due to my weight & lack of exercise.
And that it could like to heart failure, that I needed to lose weight asap. - That was the wake up call for me.
I started analyzing what was I doing wrong. And it was 4000+ calories a day, lots of soda, lots of sugar.
I lost almost 1/3 of my weight in a year by doing something simple: I cut my calorie intake to 1000 calories a day, reduced soda and sugars by 90% & started walking. Started walking 1/2 a mile a day, and now I'm up to 10 miles/day.
Once I got to my desired weight, I upped my calorie intake to 2000-2500 a day, which keeps the weight steady.
If you're gaining weight it means you're taking more calories than you're burning.
Depending on your height, go to 1000-1500 a day and you'll start seeing your weight come down slowly.
Also walk a bit, increase your distance every 15 days or so. Once you do 2-3 miles a day, with the reduced calorie intake you'll lose 2-3 lbs a month, guaranteed.
If you do 800-1200 calories, you might lose 5 lbs or more a month. You don't have to stop eating carbs or meats, just cut down on your overall intake.
Do this and see what happens. If you don't see you lost weight after a month, try something else.
But do this for a month, you have nothing to lose other than eating less, and a few pounds...you'll be motivated and willing to continue with the strategy. Once you get to your desired weight after a few months, go back to 2000 cals/day.
Best of luck, rooting for ya. And keep us updated on here.