Robin Williams, at left, in the latest ‘Night at the Museum’ installment. 20th Century Fox

Twentieth Century Fox’s “Night at the Museum: Secret of the Tomb” is a curtain call for the late Robin Williams and for the movie series he helped power to global success.

The new movie, the third installment of the family-film franchise about museum statues that magically come to life, is due in theaters Dec. 19 and co-stars Ben Stiller (as a night guard), Mr. Williams (as Theodore Roosevelt) and former “Downton Abbey” actor Dan Stevens as Lancelot. Shawn Levy, who directed all three movies, said that even before Mr. Williams’s suicide in August, the series was coming to a close.

“It’s been weird and sad but also we know and value the privilege of putting into the world this last piece of his legacy,” Mr. Levy said.

Director Shawn Levy and co-star Dan Stevens reveal why Robin Williams’ final scenes for “Night at the Museum: Secret of the Tomb” were so emotional.

The new “Night at the Museum” had finished shooting 2½ months before Mr. Williams’ death, Mr. Levy said, and the comic did some voice-recording work for the film a few weeks before his passing. Spying the image of a golden Tibetan statuette on Mr. Levy’s laptop, he offered to create a new voice to help bring the object to life in the film. “So Robin actually plays two roles in a way,” Mr. Levy said.

Mr. Levy recently parted ways with a planned movie adaptation of Microsoft Corp. ’s popular videogame Minecraft for Time Warner Inc. ’s Warner Bros. “It had a bit of a ’Goonies’ flair,” Mr. Levy said about his aborted adaptation. “But it was an adventure movie, and I thought it could have been a lot of fun and fulfilled a lot of the qualities that people love about the game.”

“Night at the Museum” director Shawn Levy tells the WSJ Cafe why he parted ways with the “Minecraft” movie.

The Minecraft movie remains on the “fast track” to getting made, according to a person familiar with the matter.

The director said he is focused on other projects, including a possible movie about Tinkerbell starring Melissa McCarthy. He also joked that if the new “Night at the Museum” grossed more than a billion dollars, he would reconsider his decision to end the franchise. “Night at the Museum” and its sequel “Night at the Museum: Battle of the Smithsonian” took in $574,480,841 and $413,106,170 respectively at the global box office, according to the movie tracking website Box Office Mojo.

Twentieth Century Fox, whose parent company is 21st Century Fox Inc., was until last year part of the same company as The Wall Street Journal.

“Night at the Museum: Secret of the Tomb” features a scene near the end where Mr. Stiller’s character bids farewell to Mr. Williams as Roosevelt. “That scene now achieves crazy new depths of poignance,” Mr. Levy said.

Follow @cjfarley on Twitter.

Write to Christopher Farley at christopher.farley@wsj.com