Create GameObject at runtime for use in editor

Is there a way to create some GameObject at runtime (in game mode) and use them later in editor.

My purpose is to interactively flight with a plane in game mode and create a path of waypoint along my trajectory that I will use later in the editor.

Is there a sort of “save prefab” feature that can be invoked by script during the game ?

I think it’s possible to save the coordinates of my waypoints while flying and create an editor script to recreate them from a file. But I just want to know is there is a simplest way.

  1. While in game mode, pause. Select the desired GameObject in the Hierarchy and copy it. When in edit mode, paste it. Quick.
  2. Save via script search terms: serialization, playersprefs, .net streams. I think that using .net streams to save a text file that represents your GameObject’s state is a good choice while you develop a game, gives you the ability to tweak things.

Thank you Ippokratis !

It works very well. Actually I’ve only tested the simplest solution (N°1). It allows me to flight around and create a path of waypoints.

After pausing the game I can get path object and all it’s waypoints children with a single copy/paste : it saves me a lot of time !