A boat ride at Epcot inspired the story, but a controversy over a Mexican holiday nearly scuttled the $175 million animated film before its first frame was drawn.

Early in preproduction for Disney's Coco — its Pixar movie (reportedly costing $175 million) set on the Mexican holiday Dia de los Muertos, or Day of the Dead — the normally politically sensitive studio made a slight misstep. It tried to trademark the name Dia de los Muertos. The backlash was understandably ferocious, with a petition against Disney drawing more than 20,000 signatures.

"[It] purely had to do with us not having a title yet," says director Lee Unkrich. "That triggered a bunch of stuff, and it really blew up. It was heartbreaking for me, because we were working so hard to do everything right and respectfully."

Four years later, nobody is talking about petitions. Indeed, the film, which was released Nov. 22, just passed $300 million at the worldwide box office and is considered a frontrunner for this year's animation Oscar. "It ended up being kind of a blessing in disguise," Unkrich says of the early trademark snafu, "because it caused us to really up our game. We had to make sure we were being as respectful as possible."

Still, there were a few bumps getting to the finish line, including the sudden departure of Pixar's chief creative force, John Lasseter, who, the day before Coco's release, said he was taking a leave of absence in the midst of allegations of misconduct.

The original idea for the film came to Unkrich, 50, during a 2011 family vacation while visiting the Mexico pavilion at Disney's Epcot theme park in Florida. "I was riding this boat and we passed a mariachi skeleton band, and that was my trigger moment," he recalls. "I started to think about the potential of telling a story set against the culture of Mexico. I had never seen a full story told against Dia de los Muertos."

[promo:1053208]

That would change in 2014, when Jorge Gutierrez's The Book of Life would debut. Meanwhile, Unkrich had been assembling the bones of his story, which would tell the tale of 12-year-old Miguel (voiced by Anthony Gonzalez, now 13), who longs to become a musician even though his family has banned music from their home for secret reasons that Miguel will discover when he's transported to the vibrant Land of the Dead.

Although his script was not yet fully formed, Unkrich — who was just coming off an Oscar win for Toy Story 3 — took his idea to Lasseter, who gave it a green light pretty much at hello. "He saw a lot of potential in it to be a colorful, vibrant film with a lot of music and emotion," says Unkrich. "We felt the family-centric theme was the way to go."

Within a few months, Unkrich embarked on a research trip to Mexico with Pixar head of story Jason Katz, production designer Harley Jessup and Pixar producer Darla K. Anderson, visiting Mexico City, Morelia, Oaxaca and Guanajuato, the last of which turned out to be a special inspiration to Jessup.

"It's a city of terraced architecture that is going up steep hillsides — very brightly colored and layered," he says. The world he eventually created for the film's Land of the Dead incorporated that look, adding huge vertical towers that reflected the "layered history of Mexico," as Jessup puts it. "At the bottom of each tower are the Aztec and Mayan pyramids; above that, Spanish colonial period buildings; above that are Mexican Revolution era and Victorian era buildings; and then into the 20th century and modern day."

Meanwhile, Unkrich began assembling more of his team, including a Mexican-American storyboard artist he'd worked with on Toy Story 3, Adrian Molina. "When he found out we were doing a story set against Mexican culture, he really wanted to be a part of it," says Unkrich. Molina, 32, came aboard as a story artist but didn't let his title get in the way. When Unkrich hit some roadblocks with his script, Molina volunteered some fresh unsolicited pages. "I submitted them, but I did it very respectfully," he recalls. "I said, 'I don't know if these are helpful to you, but I just need to get them out of my system.' But the more time we spent of the story, the more time we spent talking about what the film could be, the more we realized we were on the same page."

Molina was promoted to co-writer alongside Matthew Aldrich. A little later, he was upped to co-director.

One of the big challenges with the story was that Dia de los Muertos is such a culturally specific holiday — an autumn celebration featuring parades and colorful costumes honoring the passing of friends and family — that Unkrich worried non-Mexican audiences might not relate. "We had to assume a great percentage of the audience didn't know what Dia de los Muertos was," Unkrich says, "so we had to communicate information about the holiday organically, not with a lecture." Molina's pages introducing the key concept of "final death" — when a soul disappears forever after he or she is no longer remembered by anyone in the Land of the Living — were particularly helpful. "He nailed it," says Unkrich. "The [final death] scene [in the film] is very close to what Adrian wrote."

Meanwhile, Benjamin Bratt came on as Ernesto de la Cruz, a larger-than-life musician; Gael Garcia Bernal was cast as Hector, a down-on-his-luck drifter desperately worried about his final death; and Edward James Olmos joined as Chicharron, a grumpy music lover. That left the crucial voice role of Miguel. "At first we were doing temp dialog with a great kid named Emilio Fuentes," says Unkrich. "He was our Miguel for a couple of years while we were developing [the film]. But then his voice started to change, so I needed to find another voice. He had to be able to act, he had to be able to sing, and he had to sound like he was 12. And it was vitally important that we had a Latino."

[promo:1065933]

That's when Los Angeles native Gonzalez was hired for temp dialogue, and soon the team realized that they had found their Miguel. "When we told him he was being given the part, he fell to the ground," says Unkrich. "He was completely overwhelmed."

Throughout the production, Pixar also worked with a team of cultural advisers, including Marcela Davison Aviles, playwright Octavio Solis and political cartoonist Lalo Alcaraz (who happened to be one of the Mexican luminaries who'd been outraged when Disney tried to trademark Dia de los Muertos; he published a cartoon of a rampaging Mickey Mouse skeleton destroying a city, calling it "Muerto Mouse").

"They came to Pixar every three months when we screened the [work in progress]," says Unkrich. "We had never opened up one of our films to outside people like that before, but we thought it was vital. Every time we screened the film, there were a lot of notes. We tried to take that all to heart in a way that supported the story."

And then there was the title. Given the controversy, Day of the Dead no longer seemed like a viable option. Ultimately, the film ended up being named after Miguel's great-grandmother (voiced by Ana Ofelia Murguia), who holds the secret to his family's anti-musical past: Mama Coco.

This story first appeared in a December stand-alone issue of The Hollywood Reporter magazine. To receive the magazine, click here to subscribe.