Humor is not the first thing one associates with an M. Night Shyamalan movie, which is why it’s so surprising that “The Visit” (Universal) elicits abundant laughter, most of it by design. As expected, the film is quite spooky, but the comedy is integral and more than a relief valve. Unfortunately, because it triggers a significant amount of unintended laughter as well, too often viewers will find themselves caught between laughing with the movie and laughing at it.

The titular visit is the first time 15-year-old Becca (a budding filmmaker who tries to gain insight into her broken family by filming a documentary about them) and Tyler (an aspiring rapper with a germ phobia) will meet their grandparents. Mom left home at 19 after falling for an older man, whom she married. Five years ago, their father took off and their parents subsequently divorced.

Their mother has never reconciled with her parents, but has agreed to send the children for a weeklong visit to the farmhouse where she was raised.

While warm and welcoming, Nana (Deanna Dunagan) and Pop Pop (Peter McRobbie) exhibit peculiar behavior from the outset. Attributing their strange conduct to the mental and physical infirmities brought by old age won’t suffice. The atmosphere of dread and menace is heightened by the wintertime locale and the nearby health care facility where Nana and Pop Pop volunteer as counselors.

In his attempt to avoid presenting a run-of-the-mill horror-comedy, Shyamalan draws attention to our obsession with experiencing life through a lens, screen or other electronic device.

Shyamalan also tacks on a laudatory message about the power of forgiveness and the necessity of overcoming anger. Nevertheless, any lesson or earnest sentiment is eclipsed by the film’s humor and scare quotients.

The film contains much terrifying behavior and some non-graphic violence, an instance of rough language and one rough gesture, some crude and crass language, several instances of profanity, brief rear female nudity, a drug reference, a suicidal character, and some sexual banter, mostly contained in rap music lyrics. (A-III, PG-13).