He'd be playing Dr. Robotnik, a mad scientist and Sonic's archenemy. James Marsden previously signed on to play the beloved blue hedgehog in the film that will blend live-action and computer graphics.
Tika Sumpter ("Southside With You") has also been cast in an unspecified role.
Sega launched the Sonic game in 1991 and has sold more than 360 million copies to date across all platforms. In the game, Sonic must defeat Robotnik, a scientist who has (gasp!) imprisoned animals in robots and stolen Chaos Emeralds.
The film is getting the primo holiday release date of November 15, 2019.
Jeff Fowler, who received an Oscar nomination for his 2005 animated short "Gopher Broke," is directing. Among the producers is "Deadpool" director Tim Miller, so we are expecting snark as well as shenanigans.
Carrey's next project? Showtime's "Kidding," in which he stars as a Mr. Rogers-esque kids' TV show host who's slowly losing his mind. It premieres in September.