“Avengers: Endgame” was top secret to even the actors. Winter Soldier/Bucky Barnes actor Sebastian Stan revealed that the stars thought they were gathering at the end for a wedding scene.

[“Avengers: Endgame” spoilers are below.]

“I was told there was a wedding we were filming,” Stan revealed on “The Tonight Show with Jimmy Fallon.” “And I was like, ‘Who’s getting married?’ But everybody was dressed very formal, and I was looking around and two people weren’t there. So I guess that was the bride and the groom. But that’s what it was. It was a wedding, right? You saw the movie, it was a wedding.”

There were a couple of awkward laughs from the audience as they realized he was actually referring to Iron Man/Tony Stark’s (Robert Downey Jr.) funeral, which almost every superhero attended. Of course, the billionaire was missing along with Black Widow/Natasha Romanoff (Scarlett Johansson), who also died during the film.

It may have been a smart move to lie to the actors. After all, there were rumors of a wedding in the movie long before “Infinity War” even hit theaters. It was widely thought that Iron Man would marry Pepper Potts (Gwyneth Paltrow), which happened off screen in the film.

Presumably, the actors were eventually told by the day of filming that it was actually a funeral scene. After all, everyone was in black and they had to act very sad.

“Avengers: Endgame” was notoriously secretive. Actors weren’t given full scripts and stars like Stan, who were killed in “Avengers: Infinity War” and returned at the very end of “Endgame,” only knew the details of a few scenes.

Stan will likely get more information on his next Marvel project, “Falcon and Winter Soldier.” The Disney+ streaming series will focus on Bucky and Sam Wilson (Anthony Mackie), the latter of whom was given the Captain America shield in the movie’s final moments. The limited series does not have a premiere date yet.

“Avengers: Endgame,” which has made nearly $1.5 billion so far, is in theaters now.

Avengers Endgame "Avengers: Endgame" wrapped up with a funeral, but some actors had been told it would be a wedding. Photo: Marvel Studios