“At the time, I was 26, and after 26, 27 years of always being sick and being in chronic pain every single day and you don’t know when you’re going to have the next good day, it’s really, really hard,” Hyland told host Ellen DeGeneres.

“I would write letters in my head to loved ones — of why I did it, my reasoning behind it, how it’s nobody’s fault,” she said of her suicidal thoughts. “And I didn’t want to write it down on paper because I didn’t want anyone to find it.”

The Modern Family star has undergone two kidney transplants and 16 surgeries during her lifetime. She was “very, very, very, very close” to ending her own life when she finally shared her feelings with someone else.

“It ended up being myself that got me out of that,” the star said. “I had to do it on my own. I told myself I had to do it on my own.”

“I finally said it out loud to someone,” she recalled. “Just saying it out loud helped immensely because I kept it to myself for months and months at a time.”