James Gunn explains how Miley Cyrus ended up in Guardians of the Galaxy Vol. 2

Miley Cyrus will be partying in space for her next role. Director James Gunn has officially confirmed that the pop star has a role in Guardians of the Galaxy Vol. 2, voicing the computer Mainframeā€“ and it was her gig as a reality TV show host that got her the job.

Gunn explained to Buzzfeed News that he was watching Cyrus' stint as a judge for season 11 of The Voice when he got the idea to cast her as the comics' planetary computer. "I was admiring the tone of Miley Cyrus' voice," he said. "I find her funny and likable and sweet. I liked that she cared about the contestants. So I was like, I think she would be a funny person to have as a voice. So we contacted her, and she said yes. She came in and recorded, and she was a delight to work with."

According to Gunn, Cyrus' session lasted "an hour, at most," with the character appearing in one of the film's many, many post credits scenes. However, Gunn says it's possible that she could come swinging into other Guardians movies in the future, noting, "She knows that there's a chance that character may go on and become a bigger thing. That's a possibility." If she does return, though, don't expect her to be playing the same Mainframe you've come to know in the comics. Gunn says that his version of the character is quite different, saying, "Listen, Mainframe is barely a character in the comics. My concept of who Mainframe could be is actually pretty far out."

Cyrus' cameo is certainly unexpected, but it's not the first time thatĀ superhero movies have kept surprise appearances under wraps. Gunn, who has confirmed that he is set to return to write and direct Guardians of the Galaxy Vol. 3 at some point in the future, remained mum on the specifics of Miley's role in the story, but you will be able to see for yourself when the movie is released on May 5.