Not happy in my marriage

I have been married for a year and half and we had a baby last June, I’ve been texting my ex and my husband found out. We had a conversation about it and now he doesn’t know if he wants to stay together. I’m not in love with my husband, but we got married. I know I was wrong, and but idk if I want to stay together. I feel horrible, and I do love him, but I don’t want to resent him or our daughter because I’m not happy.