Sarah Hyland revealed that she had a second kidney transplant after struggling with her mental health, to the point where she “was contemplating suicide”

The Modern Family star, 28, has kidney dysplasia — which means her kidneys did not develop properly when she was in the womb and frequently form painful cysts — and the condition required a kidney transplant in 2012. Her father donated his kidney, but in Oct. 2016, her body started to reject it.

Get push notifications with news, features and more.

“We did all of these tests and all of these treatments to try and save the kidney,” Hyland told SELF for their latest digital cover. “Christmas break, New Year’s, Thanksgiving, my birthday, all of that spent in the hospital.”

But none of the treatments worked, and Hyland’s doctor said the kidney was like a burning house — it was already too far gone. “You can’t un-burn a house,” she said.

Image zoom Sarah Hyland Catherine Servel

Doctors removed the transplanted kidney in May 2017, and her younger brother Ian, 23, offered his kidney, which was thankfully a match. But Hyland felt conflicted.

“I was very depressed,” she said. “When a family member gives you a second chance at life, and it fails, it almost feels like it’s your fault. It’s not. But it does. For a long time, I was contemplating suicide, because I didn’t want to fail my little brother like I failed my dad.”

Image zoom Catherine Servel

Hyland started reaching out and talked someone close to her about her suicidal thoughts, which helped, she said.

“It’s not shameful,” she says. “For anybody that wants to reach out to somebody but doesn’t really know how because they’re too proud or they think that they’ll be looked upon as weak, it’s not a shameful thing to say. It’s not a shameful thing to share.”

And in Sept. 2017, she underwent the second kidney transplant. But her health problems didn’t end there — Hyland also has endometriosis, and the pain was becoming unbearable. Plus, she had a previously undiagnosed abdominal hernia.

“I was still in severe pain after the transplant, and that was due to the endo and the hernia,” she said.

That led to more surgeries — she’s had six in the last 16 months, and 16 total over the course of her life — a laparoscopic surgery for the endometrosis and a hernia repair surgery.

“Laparoscopic [surgery is] one of the most painful things I’ve ever been through in my life,” she said. And the endometriosis pain doesn’t really go away. “[This week] I’ve had a flare-up with my endo. It has been hard to stand up straight, let alone work. The fetal position helps a lot.”

Image zoom Sarah Hyland Catherine Servel

But the support of her family, (most) of her followers on social media and her boyfriend, Wells Adams, help Hyland manage her health. She and Adams first met three days before her transplant surgery, and they fell in love as she underwent treatment.

“He was texting me in the morning before I went into surgery, and we were FaceTiming the entire time I was in the hospital. He’s seen me at my worst. He was there through all of that,” she said. “I think that’s why I feel the most beautiful in his eyes, because he still finds me beautiful after seeing all that.”

RELATED VIDEO: Sarah Hyland Gets Candid About Her Health

And with the lengthy recovery, Hyland and Adams grew close before they could sleep together.