WARNING: The following article contains spoilers for Avengers: Endgame, in theaters now.

When the Marvel Cinematic Universe headed toward the giant battle with Thanos in Avengers: Infinity War, the Hulk was conspicuously absent. However, he almost played a very different role in the fateful fight before Avengers: Endgame.

In Avengers: Endgame, Hulk evolved into his popular Professor Hulk form, which combines Banner's intellect with Hulk's raw strength.

RELATED: Is Professor Hulk Bruce Banner's Personality or Something Else?

In an interview with the New York Times, screenwriters Christopher Markus and Stephen McFeely said that Professor Hulk was originally supposed to show up in Avengers: Infinity War.

"It was a lot of fun, but it came at the wrong moment," Markus said. "It was an up, right when everyone else was down."

McFeely added that Banner was supposed to become Professor Hulk in Wakanda before the final battle. "His arc was designed like, I’m not getting along with the Hulk, the Hulk won’t come out," McFeely said." And then they compromise and become Smart Hulk."

Markus added that it was difficult to show how the Hulk evolved without scenes of Banner gene-splicing.

"I wrote scenes in a lab," McFeely said. "Now it’s just him eating pancakes and I think it generally works."

RELATED: Avengers: Infinity War Nearly Included a Major Marvel Cosmic Power

In Endgame, audiences are introduced to the intelligent Hulk alongside Paul Rudd's Ant-Man, who meets the Hulk with the Avengers at a diner after being stuck inside the Quantum Realm for five years.

"The whole thing rides on [Paul] Rudd going, 'I’m so confused,'" Markus adds, wheich leans into the moment's unexpected comedy.

Directed by Joe and Anthony Russo, Avengers: Endgame stars Robert Downey Jr. as Iron Man, Chris Evans as Captain America, Mark Ruffalo as Bruce Banner, Chris Hemsworth as Thor, Scarlett Johansson as Black Widow, Jeremy Renner as Hawkeye, Brie Larson as Captain Marvel, Paul Rudd as Ant-Man, Don Cheadle as War Machine, Karen Gillan as Nebula, Danai Gurira as Okoye and Bradley Cooper as Rocket, with Gwyneth Paltrow Pepper Potts, Jon Favreau as Happy Hogan, Benedict Wong as Wong, Tessa Thompson as Valkyrie and Josh Brolin as Thanos.