Running code while in the editor

Hello everyone,

I am working on a real-time strategy game and have created a couple of buildings. At runtime, when the player places a building in the world, he or she sees a ghost preview that is deleted when the player selects the final location. At that point, a timer is started to simulate the building being constructed. Other code also runs when this construction is happening, such as registering the building with other objects on the map that need to know it exists, or creating connections with other buildings.

There are some scenarios in which I want to prepare a base for the player in the editor, but still have it run through all the code it would have if the player had placed it him or herself at runtime. Is it possible to have the gameplay code running in the editor, and then save the end-state in the level? If not, what are my alternatives? I’m open to all ideas.

Thanks!