When M. Night Shyamalan isn’t hard at work — and he’s shooting a new Apple TV series in the city right now — you’ll find him in his front-row seat at a Sixers game.

From there, he can watch coach Brett Brown wrestle with the problem of how to juggle disparate variables in order to create a winning franchise, something the director knows a thing or two about.

It’s been Shyamalan’s unprecedented achievement to make two apparently different movies (Unbreakable, Split) for two different studios many years apart, and to reveal them as the first two thirds of a trilogy that he brings to a close (though you never know) this week with the release of Glass.

The movie brings together three major characters from the first two films. There’s criminal mastermind Elijah Glass (Samuel L. Jackson), his nemesis David Dunn (Bruce Willis), and the sinister Kevin Wendell Crumb (James McAvoy). They all return — along with Split alum Anya Taylor-Joy and Unbreakable costar Spencer Treat Clark — knitted together in one of the director’s famously twisty storylines that, somehow, was all there on paper 20 years ago.

“The original Unbreakable outline had all these guys in it. It was the triangle of these guys, from Unbreakable and from Split, and it was planned for [McAvoy and Willis' characters] to meet and fight and fulfill Elijah’s dream of proving that comic books are connected to reality. That was the original plan,” Shyamalan said from New York, where was doing a media tour for Glass.

Even coming off the success of The Sixth Sense, it wasn’t an easy sell in the pre-Marvel days, when studios hadn’t awakened to the movie-going public’s untapped and apparently bottomless appetite for superhero stories and comic book characters.

And Shyamalan’s approach was unusual — presenting superheroes (or villains) as people you might meet in real life. Looking back, he said, it was already in the zeitgeist, though in a different way. A year before Unbreakable opened in 2000, HBO debuted The Sopranos, and Shyamalan saw parallels to what he was trying to do.

“My idea was to keep it human as much as possible, and that’s what The Sopranos did with gangsters,” Shyamalan said, citing Tony Soprano — more father than mobster, a guy with suburban dad problems.

“What do you do when you have anxiety? When your daughter’s not listening to you? And, yeah, he kills someone once in awhile, but the story starts with a guy we can all relate to on some level. Unbreakable sort of took that approach to comic books. What if [the person who has special powers] is your dad, or your son?”

The Sopranos hit big; Unbreakable did not. The movie made $95 million on a budget of $75 million, not enough to stoke the studio’s desire to continue with the director’s ahead-of-its-time idea, which has since been repeated and embellished in movies like Kick Ass and Chronicle.

And a discouraged Shyamalan essentially gave up.

“Definitely. For a long time, I kind of in my heart decided it wasn’t going to happen and just let it go emotionally,” he said.

Meanwhile, he was attempting blockbusterish fare like The Last Airbender and After Earth, and getting farther and farther from his roots as a storyteller. Eventually, he decided to take ownership of the situation in the most literal way — using his own money and collateral to finance the low-budget The Visit, picked up by Blumhouse horror visionary Jason Blum, who produced the Oscar-nominated Get Out, and turned into a $65 million sleeper hit.

For Shyamalan, using his own money — and using it carefully — was a creative tonic.

“When resources are limited, all of a sudden all the emphasis is on how I write it and how I direct it. What’s essential and important comes to the forefront,” he said. “You’re not going to solve every problem with money. This whole experience has really let me see benefits of working with limitations.”

Shyamalan rolled a reported $9 million in revenue from The Visit over into the long-abandoned dream of Split, which became an even bigger hit, grossing $278 million worldwide. That, in turn fed the $20 million financing for Glass — now slated to open in 3,700 theaters and tracking to open at $60 million to $70 million in North America, and as much as $120 million worldwide.

M. Night Shyamalan and Bruce Willis on the set of the 'Glass' in Philadelphia
M. Night Shyamalan and Bruce Willis on the set of the 'Glass' in Philadelphia

That’s impressive for what is essentially a self-financed film.

“It’s certainly a strange and very anomalous moment — a purely independent movie being put out in such a mass way,” said Shyamalan. Anomalous and potentially lucrative. I asked him whether he were about to become the George Lucas of thrillers. Lucas famously retained the rights to his Star Wars characters before he sold to Disney in 2012. But Shyamalan changed the subject and praised Disney (co-distributing with Universal) for getting behind Glass in a big way with marketing and distribution muscle.

“You’re still using up one of the major release slots,” he said. “And there the sense that you don’t make money unless your partner makes money, and I feel like that’s the right place to be in your life.”

Shyamalan is repeatedly grateful to be where he is — in Philadelphia, career humming, able to work close to home, which he continues to do, and which he plans to continue to do.

He says he’ll direct the first two episodes of this new Apple TV series (tentatively called The Servant) and other directors will helm the subsequent eight installments — all to be filmed in and around Philadelphia.

Then it’s on to the next motion picture.

“In a couple weeks, I’ll open up the notebook. I have two ideas I’m toying with, and when I decide on one, I’ll put pen to paper."