– M. Night Shyamalan is not done messing with you.

The director behind the brain-twister films “Unbreakable” and “The Sixth Sense” makes his TV debut with “Wayward Pines,” a 10-episode network drama that takes place in the weirdest town this side of Twin Peaks.

Even Shyamalan’s head started spinning after getting through the pilot script, written by Chad Hodge and based on a series of books by Blake Crouch.

“I remember reading it in bed and when I finished it I didn’t understand how any of this made sense. I called everyone and said, ‘If everyone isn’t really dead, I’m in,’ ” Shyamalan said. “When the writers explained the entire mythology of what was happening, it was very precise and exciting to see what this jigsaw puzzle actually becomes.”

The story unfolds largely through the eyes of Ethan Burke (Matt Dillon), a Secret Service agent who comes to Idaho to search for two missing colleagues. While there, he appears to get into a nasty car accident and winds up in a nearly vacant hospital — with no ID, no money and no way of communicating with the outside world.

On the surface, Wayward Pines doesn’t seem like a bad place to be stuck in, until Burke starts discovering little oddities, such as the fact that crickets don’t exist in these parts.

If you’re looking for quick answers, you’re in the wrong area code.

“One of the things I struggle with in film these days is that I want the first act to be the entire movie,” Shyamalan said. “But now, you just get time for a little character development and then you have to get to the boat sinking. With television, you get to develop and develop.

“That style of storytelling is very comfortable to me.”

Cast includes Melissa Leo

One can certainly understand why Shyamalan may be interested in exploring new territory. He hasn’t had a significant big-screen hit since 2002’s “Signs,” and his types of thrillers, which feature more mind games than mayhem, seem to be going out of style.

That doesn’t mean the pressure isn’t on. Fox executives, clearly observing CBS’ success with “Under the Dome,” are calling “Wayward Pines” the centerpiece of their scripted programming this summer.

“I felt from them this incredible confidence in this show that made them want to swing for the fences,” Shyamalan said. “This was their moment to hit a home run with this show. And that’s always the flip explanation. Maybe they were spinning it, but it was literally what they said. And, then, they’re going to release it in the biggest, biggest way ever, 125 countries on the same day. They are expecting 200 million people to see it. So I feel honored.”

Fox doubled down on the project by recruiting some fairly significant names. In addition to Dillon, the cast includes Oscar winner Melissa Leo, Juliette Lewis, Terrence Howard and Carla Gugino.

“I am drawn to the creative potential that television has and that you have the ability to tell a story over a long period of time,” said Dillon, who has never before been a regular in a series. “It was interesting because most of my career, I’ve been in three-act structured movies, to the point where I felt like, well, that’s the only type of structure there is. But, then, television, there really is no ending in a way. There really is no beginning. It’s all the middle part. That’s what’s kind of fun about it.”

Does that mean the director and his star are likely to return for future seasons?

“Matt and I haven’t really done television, and so what’s nice about this form is that we give to it 100 percent and see how we feel,” Shyamalan said. “I mean, I’ve intended to do a sequel to ‘Unbreakable’ forever, but I’ve never been in the right head space. If creatively, we’re hungry again, we’ll do it, but only if it’s organically and creatively correct.”