A funny thing happened on TV while the adults were busy having affairs and plotting political coups. Their kids slowly took over their shows.

Until recently, whether they were used as writers’ ploys to delve deeper into another character — think a doe-eyed Meadow Soprano asking her mob boss dad the question he’s been dreading — or straight-up stupid (“24’s” not-so-epic battle between Kim Bauer and a mountain lion), teen characters on dramas geared toward adults rarely commanded respect.

“I found that depictions of teenagers in television tend to be pretty weak. And it tends to be pretty obvious and very clear that these are characters being written by, usually, men in their 40s or 50s and it creates not-interesting characters,” says Connor Jessup [“Falling Skies”], who stars as Taylor Blaine on the second season of ABC’s anthology series “American Crime,” created by John Ridley.

Jessup’s character was at the center of the drama as he struggled with ramifications from his rape allegations against another boy. “I was very impressed by John and his team’s abilities. This season sort of lives or dies on the emotional validity of what these kids are going through. (The writers) were weirdly perceptive.”

This shift may be in part because showrunners and networks have noticed the number of millennials and members of generation Z tuning into grown-up programming: “Empire,” “Scream Queens,” and “Once Upon a Time” are on the list of top-rated entertainment broadcast programming among teens. But the change is happening across platforms. In addition to “American Crime,” which focused on events at two high schools this year, several other series have stories that young people can relate to — even if they are offering an extremely heightened version of real life.

“Finding out that [this season,] Debbie was going to get to be pregnant and have a child was shocking,” says “Shameless” actress Emma Kenney, who plays 15-year-old Debbie Gallagher on the Showtime series. “It was a storyline I didn’t expect and I struggled with at first because, obviously, I’ve never been a pregnant teenager. But I can relate to Debbie in a sense because having that baby will help her find ways to fit in. As a teenager, we all struggle with ways to fit in.”

Teenage supporting characters are also increasingly being given material that directly affects the outcome of the leads, as opposed to operating in a disconnected B storyline.

“That’s always been one of my favorite parts about playing this role. It’s such a common storyline to see the teenage girl who’s obsessed with a guy or in a relationship,” says Holly Taylor, whose character Paige Jennings on FX’s “The Americans” has spent the bulk of this season making amends to her KGB spy parents for a major breach of trust. “I mean, not everybody’s parents are spies. But there are teenage girls out there who maybe don’t get the attention they need at home and have to find it elsewhere like she does with [religion]. She’s a real kid and she focuses on so many things other than drama in school or relationships.”

The increase in stories, however, has not necessarily translated to awards love for these actors. “Mad Men’s” Kiernan Shipka and “Parenthood’s” Mae Whitman were routinely snubbed for Emmy nominations, much to fans and critics’ chagrin. “Malcolm in the Middle’s” Frankie Muniz was the last male actor to receive a nomination for playing a teenager on a continuing series. Lea Michele was nominated for “Glee,” another comedy. Before her, Amber Tamblyn and Lauren Ambrose were nominated for dramas “Joan of Arcadia” and “Six Feet Under,” respectively.

And the social media evisceration of characters like Dana Brody (Morgan Saylor) on Showtime’s “Homeland” leave wounds that are still healing as many young actors — like their co-stars — must deal with the wrath of audience members who can’t always separate the person from the part.

“I feel really protective of her,” says Julia Goldani Telles, who steals scenes as Whitney Solloway, the world’s most scheming daughter on Showtime’s “The Affair.” “I don’t want people to say bad things about her online, but it’s nice that she’s eliciting some sort of reaction. I think that some people forget that she bridges the perspective for all four worlds [of the show’s lead characters].”

Young actors who grew up in the industry also have to navigate the transition from more juvenile to adult-oriented material.

“Coming from doing children’s programming — and I know also from my friends who were on the Disney Channel — it’s tough to go from doing that and want to continue acting and do new and interesting projects,” says G Hannelius, who starred in Disney Channel’s “Dog With a Blog” and also appears in the A&E miniseries “Roots.” “I’m growing up, and people who are watching the Disney Channel shows are growing up.”

But sometimes it’s handy to have a young person on set. Both Taylor and “Fresh Off the Boat” star Hudson Yang have received history lessons just by working on their period-set shows. Taylor learned how to use a rotary phone, the hazards of ’80s fashion and not to type on a calculator in the same way you would text a message. Yang has developed an appreciation for not only diversity on TV and for Eddie Huang — the bad boy chef his character is based on in the ABC sitcom — but also the early film stylings of Jim Carrey (“Somebody stop me!” he says during an interview, quoting Carrey’s 1994 pic “The Mask”).

Others on more contemporary shows, like “The Affair’s” Goldani Telles and “Ray Donovan’s” Kerris Dorsey, have lent writers’ their expertise in the teenage vernacular. Both Dorsey and Kenney admit to using the Internet to better understand their characters.

“I can maybe be more knowledgeable about how kids speak,” says Dorsey before joking that “maybe the teenage lingo consultant might be a good thing. I’m going to put it out there now. That’s my next career move.”

It is probably worth noting that several of these shows were either created by or run by women. And many, like “The Americans,” benefit from having strong adult female characters.

“I think they did a great job of finding a honest 15-year- old’s voice in the dialogue,” says Kyle Allen, who plays Hawk, the teenage son of Aaron Paul and Michelle Monaghan’s characters on Hulu’s “The Path.” The series, which follows members of a cult-like religious group, was created by “Parenthood” vet Jessica Goldberg. His business manager received a copy of The Way ministry group’s book when he was auditioning for his role.

After several seasons of playing the darkly tormented modern-day Oedipus, Norman Bates, on A&E’s “Bates Motel,” Freddie Highmore joined his show’s writing staff. The first episode to have his credit aired in May.

“Norman’s not written as the traditional, angsty teenage boy, or at least his angst is certainly different from most,” Highmore says. “It’s all about finding the nuances of being a teenage boy and discussing in detail what his relationship with his mother is. … The responsibility this year, both in terms of the acting and the writing, was to keep Norman as sympathetic as possible.”

Highmore adds it was key to avoid having all the blame for his character’s violent acts fall on Norman. His mother, Norma (Vera Farmiga) also shoulders some responsibility for the way her kid turned out.

That’s something both teens and former teens can relate to.