Why do people not say how unhappy they are and then dump you out of the blue?

Instead of just communicating in the first place?

My [now] ex did this to me. He knew I was in love with him and then dumped me by text, out of the blue
after almost a year of dating