Imagine having a magic wand that lets you create worlds studded with castles, forests and cities, and filled with flying heroes and villains. That’s what you can do with Infinity’s Toy Box feature. Toy Box drops players inside an empty shell and lets them build a world of their own, complete with music, buildings, bystanders and bad guys.

“This is your imagination,” says Disney Interactive Studio Vice President John Blackburn, from the team’s unassuming building in Salt Lake City, which it shares with the Social Security Administration, a few lawyers and business-software maker Workday.

You’d never guess one of the world’s most popular video games is made here until you step off the elevator onto the ninth floor. Glass cases display concept sketches of popular Marvel and Disney characters, along with the actual figurines. Life-size statues of Sulley and Mike Wazowski from the movie “Monsters, Inc.” stand by the entrance, while scenes from classic Disney movies such as “Peter Pan” festoon the walls.

Infinity, which cost a reported $100 million to develop, gives kids two ways to play: standard storylines with scripted action and the Toy Box. Both modes work with an ever-growing cast of characters. That’s because Disney has released a new version of the game every year since its August 2013 launch. (A “starter pack” with two figurines costs $65.) Each release adds new storylines that complement that year’s new toys. So far, more than 100 characters can either inhabit specially written plots and adventures, or mix it up in the Toy Box. Characters, which cost $14 apiece, range from the classics, like Donald Duck and Minnie Mouse, to Marvel’s Ultron supervillain and Yoda from “Star Wars.”

Blackburn, who first envisioned the feature in 2008, thinks of Toy Box as the video game equivalent of a child dumping all her toys on the floor and then deciding how to play with them.

That’s what it’s like for Georgiana Lee, 6. She loves the way Spider-Man can climb and swing around Cinderella’s castle and then fly with Tinker Bell and other Disney friends. “It’s really cool and it has everything,” she says.

Blackburn came up with the idea for Toy Box when his team was talking to Disney’s Pixar division about creating a game for the 2010 movie “Toy Story 3.” He wanted players to experience the adventures of Woody, Buzz Lightyear and the other toys that come to life when humans aren’t looking.

“Toy Story 3: The Video Game,” complete with rudimentary Toy Box software, was a hit. More than 6 million units sold that year, far better than the 1 million units that typically constitutes a winner. That success emboldened Blackburn to pitch a more ambitious game, encompassing nearly all Disney characters. Blackburn knew he needed the backing of at least one high-level company executive. He got it from John Lasseter, Pixar’s chief creative officer.

But there was a catch.

Lasseter — who has overseen some of the world’s most successful animated films, including “Toy Story” and “Finding Nemo” — wanted Blackburn’s team to create toys that could interact with the game. Lasseter told art director Jeff Bunker those toys had to be “wicked awesome.”