How to Serialize an array of GameObjects?

How do you serialize (using the binary formatter) an array of GameObjects?

You have to create a workaround for Monobehavior-related classes. For example, you can store the GO’s name as a string and then when deserializing use the string to load the Prefab gameobject that carries this name from Resources and instantiate it. Even better would be to have a complete “Container” class for gameobjects, that hold the (Prefab)name/path, position, rotation, parent object (if any), and so on. transform.rotation and .position are Vector3s so they also need workarounds themselves; three ints each for the xyz values are sufficient in this case.

I give all the objects that need to be saved and loaded a simple “ObjectID” script which holds their ID (int) and parentID (int). Whenever an object that will need saving later gets instantiated, it is given such a script and a unique ID is generated, along with assigning the ID of it’s parent if there is one. This lets me hold a reference to this gameobject by using this ID number.

To return to your original question, as soon as you have created a workaround for the gameobject class, it doesn’t matter much if you want to serialize gameobject or an array of them.