destroyimmediate then bring back

I’m making an editor script that saves your selection as a new scene by inverting selection, destroyimmediate on selected, then somehow bringing the destroyed objects back. Currently it works when I do it with simply undoing at the end of the script with Undo.PerformUndo(), however that throws a peculiar error whenever I use the function in any way at all.

At this point I’m looking for other ways to store the destroyed objects and bring them back. I wouldn’t think writing them to the hard drive in any way is not an option (it would be too slow). Anyone have any ideas?

Why would writing to the hard drive be too slow? It should be a small fraction of a second. Your computer saves lots of stuff to the hard drive all the time and you don’t even notice.

–Eric

Well I’m making a system where there are many tiles in a scene and each tile represents a scene. This is all so the scenes can be authored in one big scene but loaded in chunks with LoadLevelAdditiveAsync. The batch save scene loops through potentially hundreds of tiles, so a fraction of a second might add up to a fraction of a minute. Plus since this function repeats so many times it seems dirty to write and delete, write and delete. But I’m open to anything! If you have something that might work I’d appreciate your input and am willing to try it.