Ezra Miller. Picture: AP

Hollywood actor Ezra Miller has revealed he was told he'd done a "silly thing" by revealing he was gay.

The 25-year-old actor opened up about his sexuality during an interview five years ago, but Ezra was subsequently told by numerous people that the decision to come out would harm his future career prospects.

READ: Ezra Miller on Zack Synder's 'lighter' Justice League

He explained: "Folks in the industry, folks outside the industry. People I've never spoken to. They said there's a reason so many gay, queer, gender-fluid people in Hollywood conceal their sexual identity, or their gender identity in their public image.

"I was told I had done a 'silly' thing in ... thwarting my own potential to be a leading man."

Despite this, Ezra has subsequently starred in a string of high-profile movies, such as 'Batman v Superman: Dawn of Justice' and 'Fantastic Beasts and Where to Find Them'.

And the American star finds it sad that so many people in Hollywood still feel it's necessary to keep their own sexuality a secret.

Ezra told ShortList magazine: "'You've made a mistake' is such a hard thing to hear. 

"Maybe if I'd actually made a serious mistake? But not for this. I didn't think I'd done anything wrong, though there have been moments of doubt as a result of those conversations. 

excuse the nipples @interviewmag

A post shared by Ezra Miller (@imezramiller) on

"But ... what they said was, in fact, 'rubbish'. It is us to manifest the world we want to exist in. But we're ready. Humans are ready."

Meanwhile, Ezra previously claimed that the gay community continues to be under-represented in cinema.

The actor explained: "We're not seeing a lot of queer or trans people of colour in films - everything is still incredibly whitewashed."

In fact, Ezra cited transphobia as being a particularly big problem within the film business.

He said: "There's still a lot of homophobia and what we're really confronting now is transphobia."