When Don Knotts was on his deathbed, his daughter Karen needed to run out of the room so she could laugh.

The actor, best known for starring as bumbling, bug-eye Deputy Barney Fife on “The Andy Griffith Show,” died in 2006 at age 81 from pulmonary and respiratory complications.

Karen is currently in the process of writing a memoir and is now performing a show about her childhood titled “Tied Up In Knotts!”

She told Closer Weekly Saturday that anyone who knew her father wouldn’t be surprised by her shocking response.

“Here’s the thing about my dad,” she explained. “He had this funniness that was just completely, insanely natural. When he was dying, he was making us laugh in hysterics.

"He was literally dying, but he did something or said something that caused my stepmother and me to go into fits of laughter, which is why I ran out. I thought to myself, ‘I don’t want to be standing there in front of this man, my dearly beloved father, who’s dying, and laughing.'”

But Karen does have one regret about one of her final moments with the celebrated comedian.

“I was telling this story to Howard Storm, who’s a director, and he said, ‘You should have stayed and laughed out loud,’” she said. “‘That’s what comedians live for!’ He was right; I should have just stood there and blasted out laughing.”

Karen insisted that Knotts, who enjoyed a successful half-century acting career that included seven television shows and more than 25 films, along with five Emmy Awards just from “The Andy Griffith Show” alone, never lost his sense of humor despite his difficult childhood.

The magazine revealed Knotts was born in West Virginia to a mother who was 40 at the time and a father who suffered from both schizophrenia and alcoholism. Growing up, his father would reportedly hold a knife to Knotts’ neck and threaten him.

“My dad was very burdened down by all these problems,” said Karen. “He had problems with his father and an older brother who tormented him because they were alcoholics.

"When his father passed, he was 13 years old. At that point, that burden — that huge burden — lifted off him, and he became old enough that he was able to get the other brother under control, so he was no longer terrorized at home.”

Knotts eventually spent years in therapy but also found solace in entertaining. When he served in the U.S. Army from 1943 to 1946, he participated in a variety show that toured the Pacific.

“He saw ventriloquism as a way for him to get out of his impoverished surroundings,” said Karen.

And when he later took on the iconic role of Fife on “The Andy Griffith Show” in 1960, he happily immersed himself in the workload.

“We didn’t see him a lot, because he worked 10, 12 hours a day,” said Karen. “And when he was home, he was always holed up in his room working on his lines and stuff like that. At that time, we kids were pretty young, and he confided whatever he was feeling about working on the show to my mom.

"I remember watching and listening to him rehearse. He asked me to run lines. At the time, I already knew I wanted to act, so I would try to act it out and he’d say, ‘No, no, no. Just give me the lines straight, no inflection, nothing, otherwise you throw me off.’ I was just part of that process.”

Knotts always had his children in mind. Karen recalled how she frequently visited the set and befriended Griffith.

“He was very friendly to me; he was like an uncle,” she explained. “He had different sides. You could see that sometimes he would be intense, and other times very, very warm and endearing.

"One thing I will tell you, and one thing that is different from what has been written in books, was that Andy was never jealous of my dad. He was his biggest fan and mentor. Everything later he was in, he wanted to get my dad in, too… He was in my dad’s corner.”

“The Andy Griffith Show” aired from 1960 until 1968. And when Griffith pursued a new series titled “Matlock” in 1986, he was determined to have Knotts by his side.

“Even when he was on ‘Matlock,’ and my dad wasn’t working at the time, he went to producers and said, ‘I want Don Knotts on the show,” claimed Karen. “They said, ‘No, this is a dramatic show, there’s no part for a character comedian.’

"He kept fighting and fighting, and then they put him on, but they didn’t want to pay him much. Andy went to the mat and fought with them on that. They gave him not really what he should have gotten, but at least a decent salary.”

Knotts appeared on “Matlock” from 1988 until 1992. The series came to an end in 1995.

But Knotts never forgot about his horrific past. Karen shared he spent years in therapy.

“He was mercurial,” she said. “He had a lot of different kinds of moods. He fought a lot of depression and I helped him, or thought I did, because I could see how he had this endless loop of thought that would always lead to a downward spiral. I would try to break through that and was like Pollyanna, pointing out the positives.

“Of course, I couldn’t do much. I was a kid. He got a great psychiatrist named Duke Renniker. Duke was able to help him a lot. By the end, he had overcome everything that was down in his life. I felt really, really proud of him for all the work that he put into being a happy person. And the truth is, he loved people.”

And despite getting older, Knotts was determined to pursue his passion to entertain. His last credited role was in 2006 for voicing a deputy bloodhound named Sniffer in “Air Buddies.”

“He was also a very loving father,” said Karen. “He didn’t like to go out and do things like you picture most fathers going out and doing — you know, outdoorsy stuff — because he was a very internal kind of person. He liked to tell stories and talk… We talked about show business a lot. He was a showbiz person.”